OpenTelemetry Agent - Java Jetty App Server Installation
Installation Steps with no OpenTelemetry Collector
- Gather the vFunction Server UI’s UUID for the vFunction Distributed Application
- Log into the vFunction Server UI
- In the top-left corner, click the dropdown
- Click Add Application from the dropdown menu
- Type a name for the Application in the Application Name text field
- Toggle the slider to Distributed
- Click the blue Create button
- In the dialog box that launches, toggle the tabs to Java
- In the text box with OTEL Environment Variables, find the OTEL_EXPORT_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_HEADER. These will be used at a later stage of the installation
- Download the Open Telemetry Java Agent
- Move the Opentelemetry-javaagent.jar to a place on the filesystem where the Java application runs
- Add the Java Agent JVM parameters to the Application
- On the Jetty Application Server, open JETTY_HOME/bin/jetty.sh
- Find the section of the file for setting the Java VM options
/Java VM options
- Add the lines below to this file
VF_BASE_PATH="/opt/jetty/agents"
VF_SERVER_URL="https://vfunction.mycompany.com"
VF_APP_ID="UUID-FROM-VF-SERVER"
MY_SERVICE="NAME-OF-SERVICE"
VFUN_OPTS="-javaagent:$VF_BASE_PATH/opentelemetry-javaagent.jar -Dotel.exporter.otlp.protocol=http/protobuf -Dotel.exporter.otlp.endpoint=$VF_SERVER_URL/api/unauth/otlp -Dotel.traces.exporter=otlp -Dotel.exporter.otlp.traces.headers=X-VF-APP=$VF_APP_ID -Dotel.metrics.exporter=none -Dotel.logs.exporter=none -Dotel.service.name=$MY_SERVICE"
JAVA_OPTIONS="$JAVA_OPTIONS $VFUN_OPTS"
- Restart the application
Installation Steps with an OpenTelemetry Collector
- Download the Open Telemetry Java Agent
- Move the Opentelemetry-javaagent.jar to a place on the filesystem where the Java application runs
- Add the Java Agent JVM parameters to the Application
- On the Jetty Application Server, open JETTY_HOME/bin/jetty.sh
- Find the section of the file for setting the Java VM options
/Java VM options
- Add the lines below to this file
### Set values below
VF_BASE_PATH="/opt/jboss/agents"
COLLECTOR_URL="https://collector:4318"
MY_SERVICE="NAME-OF-SERVICE"
VFUN_OPTS="-javaagent:$VF_BASE_PATH/opentelemetry-javaagent.jar -Dotel.exporter.otlp.endpoint=$COLLECTOR_URL -Dotel.service.name=$MY_SERVICE"
export JAVA_OPTS="$VFUN_OPTS $JAVA_OPTS"
- Restart the Application