Manual setup with -javaagent flagedit

Download the Java agentedit

The first step in getting started with the Elastic APM Java agent is to download the latest free of the agent jar file from ace cardinal .

Agents are not like regular application dependencies. Don ’ metric ton declare a addiction to the agent in your application .

Add -javaagent flagedit

When starting your application, add the JVM flag -javaagent:/path/to/elastic-apm-agent-.jar

Set up the agent with Application Serversedit

different application servers have unlike ways of setting the -javaagent sag and system properties .
note that system properties are only one way of configuring the agent but setting the -javaagent flag is required in each subject. See Configuration to learn about how to configure the agent with a shape file or environment variables .

Generic Setupedit

Start your application ( for example a spring Boot application or other embedded servers ) and add the -javaagent JVM flag. Use the -D prefix to configure the agent using system properties .

java -javaagent:/path/to/elastic-apm-agent-.jar -Delastic.apm.service_name=my-cool-service -Delastic.apm.application_packages=org.example,org.another.example -Delastic.apm.server_url=http://localhost:8200 -jar my-application.jar

Apache Tomcatedit

Create bin/setenv.sh ( or modify if the file already exists ). Make surely to make the file feasible, for exercise chmod +x bin/setenv.sh
Add the following agate line :
setenv.sh.

export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/elastic-apm-agent-.jar"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.service_name=my-cool-service"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.application_packages=org.example,org.another.example"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.server_url=http://localhost:8200"

Create bin\setenv.bat ( or modify if the file already exists ) .
setenv.bat.

set CATALINA_OPTS=%CATALINA_OPTS% -javaagent:C:/path/to/elastic-apm-agent-.jar
set CATALINA_OPTS=%CATALINA_OPTS% -Delastic.apm.service_name=my-cool-service
set CATALINA_OPTS=%CATALINA_OPTS% -Delastic.apm.application_packages=org.example,org.another.example
set CATALINA_OPTS=%CATALINA_OPTS% -Delastic.apm.server_url=http://localhost:8200

choice 1 : edit jetty.sh
jetty.sh.

export JAVA_OPTIONS="${JAVA_OPTIONS} -javaagent:/path/to/elastic-apm-agent-.jar"
export JAVA_OPTIONS="${JAVA_OPTIONS} -Delastic.apm.service_name=my-cool-service"
export JAVA_OPTIONS="${JAVA_OPTIONS} -Delastic.apm.application_packages=org.example,org.another.example"
export JAVA_OPTIONS="${JAVA_OPTIONS} -Delastic.apm.server_url=http://localhost:8200"

option 2 : edit start.ini
start.ini.

--exec
-javaagent:/path/to/elastic-apm-agent-.jar
-Delastic.apm.service_name=my-cool-service
-Delastic.apm.application_packages=org.example,org.another.example
-Delastic.apm.server_url=http://localhost:8200

option 3 : If you are using embedded Jetty, see generic Setup .

Standalone Modeedit

Add the agent shape at the bottom of the standalone.conf file :
Unix
bin/standalone.conf.

export JAVA_OPTS="$JAVA_OPTS -javaagent:/path/to/elastic-apm-agent-.jar"
export JAVA_OPTS="$JAVA_OPTS -Delastic.apm.service_name=my-cool-service"
export JAVA_OPTS="$JAVA_OPTS -Delastic.apm.application_packages=org.example,org.another.example"
export JAVA_OPTS="$JAVA_OPTS -Delastic.apm.server_url=http://localhost:8200"

Windows

bin/standalone.conf.bat.

set JAVA_OPTS=%JAVA_OPTS% -javaagent:C:/path/to/elastic-apm-agent-.jar
set JAVA_OPTS=%JAVA_OPTS% -Delastic.apm.service_name=my-cool-service
set JAVA_OPTS=%JAVA_OPTS% -Delastic.apm.application_packages=org.example,org.another.example
set JAVA_OPTS=%JAVA_OPTS% -Delastic.apm.server_url=http://localhost:8200
Domain Modeedit

Edit the domain.xml file which is normally located under domain/configuration and add a JVM choice for the -javaagent flag, equally well as some system properties for the shape .
domain/configuration/domain.xml.

...

  
     
      ...
      
      ...
     
  

...

  
  
  

...

WebSphere Libertyedit

Add the pursuit lines to the jvm.options file .
jvm.options.

-javaagent:/path/to/elastic-apm-agent-.jar
-Delastic.apm.service_name=my-cool-service
-Delastic.apm.application_packages=org.example,org.another.example
-Delastic.apm.server_url=http://localhost:8200

Update the domain.xml file to add the -javaagent ease up and system properties .
glassfish/domains/domain1/config/domain.xml.


  ...
  -javaagent:/path/to/elastic-apm-agent-.jar
  -Delastic.apm.service_name=my-cool-service
  -Delastic.apm.application_packages=org.example,org.another.example
  -Delastic.apm.server_url=http://localhost:8200

Oracle WebLogicedit

Edit the startWebLogic.sh file and add the follow lines after the setDomainEnv.sh call :
$DOMAIN_HOME/bin/startWebLogic.sh.

export JAVA_OPTIONS="$JAVA_OPTIONS -javaagent:/path/to/elastic-apm-agent-.jar"
export JAVA_OPTIONS="$JAVA_OPTIONS -Delastic.apm.service_name=my-cool-service"
export JAVA_OPTIONS="$JAVA_OPTIONS -Delastic.apm.application_packages=org.example,org.another.example"
export JAVA_OPTIONS="$JAVA_OPTIONS -Delastic.apm.server_url=http://localhost:8200"

Edit the startWebLogic.cmd file and add the follow lines after the setDomainEnv.cmd call :
%DOMAIN_HOME%\bin\startWebLogic.cmd.

set JAVA_OPTIONS=%JAVA_OPTIONS% -javaagent:C:/path/to/elastic-apm-agent-.jar
set JAVA_OPTIONS=%JAVA_OPTIONS% -Delastic.apm.service_name=my-cool-service
set JAVA_OPTIONS=%JAVA_OPTIONS% -Delastic.apm.application_packages=org.example,org.another.example
set JAVA_OPTIONS=%JAVA_OPTIONS% -Delastic.apm.server_url=http://localhost:8200

Cloud Foundryedit

The Elastic Java APM Agent Framework is now part of the Cloud Foundry Java Buildpack as of Release v4.19 .
A drug user provided Elastic APM service must have a name or tag with elastic-apm in it so that the Elastic APM Agent Framework will mechanically configure the application to work with the service .
Create a user provided service :
cf cups my-elastic-apm-service -p '{"server_url":"https://my-apm-server:8200","secret_token":"my-secret-token"}'
Bind the application to the service :
cf bind-service my-application my-elastic-apm-service

or use the services pulley in the application manifest file .
For more details on the Elastic Java APM Agent Framework for Cloud Foundry see hera .
manifest.yml.

applications:
- name: my-application
  memory: 1G
  path: ./target/my-application.jar
  services:
    - my-elastic-apm-service

Leave a Reply

Your email address will not be published.