Configure the Java agent for Google App Engine

  • Updated

To add the Contrast agent in your Google App Engine environment:

Contrast only works in your locally deployed instance of App Engine. Google App Engine in the cloud does not support the Java instrumentation libraries that Contrast requires, but you can still run this integration locally.

  1. If you use Maven to deploy your application, you need to edit your pom.xml file under <build>/<plugins>/<plugin> with a groupid of <groupId>com.google.appengine</groupId> and artifactid of <artifactId>appengine-maven-plugin</artifactId>.

  2. Replace <YourContrastJarPath> with the path to your Contrast JAR and <YourAppName> with the name of your application. Then add this code:

    <configuration>
        <jvmFlags>
            <jvmFlag>-javaagent:<YourContrastJarPath></jvmFlag>
            <jvmFlag>-Dcontrast.application.name=<YourAppName></jvmFlag>
        </jvmFlags>
    </configuration>

    The result should look like this:

    <plugin>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-maven-plugin</artifactId>
        <version>1.9.0</version>
        <configuration>
            <jvmFlags>
                <jvmFlag>-javaagent:<YourContrastJarPath></jvmFlag>
                <jvmFlag>-Dcontrast.application.name=<YourAppName></jvmFlag>
            </jvmFlags>
        </configuration>
    </plugin>

    If you don't provide the -Dcontrast.application.name JVM flag, Contrast will refer to your application by the name ROOT.

  3. After you edit the file, install and run the Java agent with the following commands:

    mvn clean install
    mvn appengine:devserver
  4. When you launch your application, the Contrast Java agent will instrument and monitor it.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request