com.getsentry.raven.appengine.event.helper.AppEngineEventBuilderHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of raven-appengine Show documentation
Show all versions of raven-appengine Show documentation
Raven module allowing to use GoogleApp Engine and its task queueing system.
package com.getsentry.raven.appengine.event.helper;
import com.google.appengine.api.utils.SystemProperty;
import com.google.apphosting.api.ApiProxy;
import com.getsentry.raven.event.EventBuilder;
import com.getsentry.raven.event.helper.EventBuilderHelper;
/**
* EventBuildHelper defining Google App Engine specific properties (hostname).
*/
public class AppEngineEventBuilderHelper implements EventBuilderHelper {
/**
* Property used internally by GAE to define the hostname.
*
* @see GAE: App Identity Java API
*/
private static final String CURRENT_VERSION_HOSTNAME_PROPERTY =
"com.google.appengine.runtime.default_version_hostname";
@Override
public void helpBuildingEvent(EventBuilder eventBuilder) {
ApiProxy.Environment env = ApiProxy.getCurrentEnvironment();
// Set the hostname to the actual application hostname
eventBuilder.withServerName((String) env.getAttributes().get(CURRENT_VERSION_HOSTNAME_PROPERTY));
eventBuilder.withTag("GAE Application Version", SystemProperty.applicationVersion.get());
eventBuilder.withTag("GAE Application Id", SystemProperty.applicationId.get());
}
}