Java Instrumentation
OpenTelemetry trace instrumentation for the Java application can be enabled either through auto instrumentation or manual instrumentation. It is recommended to use auto-instrumentation unless you have specific reasons not to do so.
Please follow the steps mentioned below to enable auto instrumentation for Java.
Download opentelemetry-javaagent.jar from Release and place the JAR in your preferred directory.
Add
-javaagent:path/to/opentelemetry-javaagent.jar
and other params as mentioned below to your JVM startup arguments and launch your app:java -javaagent:path/to/opentelemetry-javaagent.jar -Dotel.metrics.exporter=none -Dotel.exporter.otel.traces.endpoint=your-otel-collector-endpoint -jar myapp.jar
Please add the following environment variable
OTEL_RESOURCE_ATTRIBUTES="service.name=your-service-name,service.namespace=your-service-namespace"
You can find more information on OTel instrumentation here
Last updated