Java APM on Linux
  • 01 May 2020
  • 1 Minute To Read
  • Contributors
  • Print
  • Share
  • Dark
    Light

Java APM on Linux

  • Print
  • Share
  • Dark
    Light

This document details how to install the Java APM Profiler in your Java application running on Linux.

Prerequisite

Follow the Retrace Linux Install Guide.

Step 1 - Enable the Stackify Java Profiler

The Stackify Java Profiler is enabled by the -javaagent JVM option:

Tomcat

Modify catalina.sh or setenv.sh:
CATALINA_OPTS="$CATALINA_OPTS -javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar"

Wildfly / JBoss

Modify standalone.conf:
JAVA_OPTS="$JAVA_OPTS -javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar"

Jetty

Modify jetty.sh:
JAVA_OPTIONS="$JAVA_OPTIONS -javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar"

Glassfish

Add the following line to the java-config section of the Glassfish domain.xml file:
<jvm-options>-javaagent:"/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar"</jvm-options>

WebSphere

Create a jvm.options under WEBSPHERE/usr/servers/SERVER with:
-javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar

Depending on your preferences, you may configure a single JVM or all Liberty JVMs with your options file.

  • To apply these settings to a single server, save jvm.options at ${server.config.dir}/jvm.options
  • To apply these changes to all Liberty JVMs, save jvm.options at: ${wlp.install.dir}/etc/jvm.options. This will take effect for all JVMs that do not have a locally defined jvm.options file.

Play Framework 1.2.x - 1.4.x

Before running your application, enter the following command:
export JAVA_OPTS='-javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar'

Play Framework 2.x+

Run the application with the following argument:
-J-javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar

Step 2 - Configure Application

Configure how your Java application is identified by using a properties file or passing in java system properties.

Properties File Option

Create a stackify-api.properties file inside your application's classpath with the following contents:

stackify.application=My Java Application 
stackify.environment=Production

Java System Properties Option

Application and Enviornment can be setup by passing in Java System Properties via:

java -DSTACKIFY_APPLICATION_NAME="My Java Application" -DSTACKIFY_ENVIRONMENT_NAME="Production"  ...

Restart Your Web Server
After modifying your configuration, you must now restart your application server.
Was This Article Helpful?