When instrumenting an app that runs on a Java application server with a Java
agent, you must add the javaagent
path to the JVM arguments. The way to do
this differs from server to server.
You can add the javaagent
argument at the end of the standalone configuration
file:
# Add to standalone.conf
JAVA_OPTS="$JAVA_OPTS -javaagent:/path/to/opentelemetry-javaagent.jar"
rem Add to standalone.conf.bat
set "JAVA_OPTS=%JAVA_OPTS% -javaagent:<Drive>:\path\to\opentelemetry-javaagent.jar"
To define the path to the Java agent, use the -javaagent
argument:
java -javaagent:/path/to/opentelemetry-javaagent.jar -jar start.jar
If you use the jetty.sh
file to start Jetty, add the following line to the
\<jetty_home\>/bin/jetty.sh
file:
JAVA_OPTIONS="${JAVA_OPTIONS} -javaagent:/path/to/opentelemetry-javaagent.jar"
If you use the start.ini file to define JVM arguments, add the javaagent
argument after the --exec
option:
#===========================================================
# Sample Jetty start.ini file
#-----------------------------------------------------------
--exec
-javaagent:/path/to/opentelemetry-javaagent.jar
Add the path to the Java agent using the asadmin
tool:
<server_install_dir>/bin/asadmin create-jvm-options "-javaagent\:/path/to/opentelemetry-javaagent.jar"
<server_install_dir>\bin\asadmin.bat create-jvm-options '-javaagent\:<Drive>\:\\path\\to\\opentelemetry-javaagent.jar'
You can also add the -javaagent
argument from the Admin Console. For example:
-javaagent:/path/to/opentelemetry-javaagent.jar
Make sure that the domain.xml file in your domain directory contains a
<jmv-options>
entry for the agent.
Add the path to the Java agent to your startup script:
# Add to <tomcat_home>/bin/setenv.sh
CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/opentelemetry-javaagent.jar"
rem Add to <tomcat_home>\bin\setenv.bat
set CATALINA_OPTS=%CATALINA_OPTS% -javaagent:"<Drive>:\path\to\opentelemetry-javaagent.jar"
Add the path to the Java agent to your domain startup script:
# Add to <domain_home>/bin/startWebLogic.sh
export JAVA_OPTIONS="$JAVA_OPTIONS -javaagent:/path/to/opentelemetry-javaagent.jar"
rem Add to <domain_home>\bin\startWebLogic.cmd
set JAVA_OPTIONS=%JAVA_OPTIONS% -javaagent:"<Drive>:\path\to\opentelemetry-javaagent.jar"
For managed server instances, add the -javaagent
argument using the admin
console.
Add the path to the Java agent to the jvm.options
file. For a single server,
edit ${server.config.dir}/jvm.options
, and for all servers, edit
${wlp.install.dir}/etc/jvm.options
:
-javaagent:/path/to/opentelemetry-javaagent.jar
Restart the server after saving the file.
Open the WebSphere Admin Console and follow these steps:
-javaagent:/path/to/opentelemetry-javaagent.jar
.[i18n] feedback_question
Thank you. Your feedback is appreciated!
Please let us know how we can improve this page. Your feedback is appreciated!