All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.getsentry.raven.appengine.event.helper.AppEngineEventBuilderHelper Maven / Gradle / Ivy

There is a newer version: 8.0.3
Show newest version
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());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy