Java OpenTelemetry APM
OpenTelemetry Java uses a Java agent JAR attached to any Java 8+ application.
Complete these tasks to properly integrate OpenTelemetry APM in Java:
Install
Zero-code instrumentation with Java uses a Java agent JAR attached to any Java 8+ application. It dynamically injects bytecode to capture telemetry from many popular libraries and frameworks.
curl -L -O https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
export JAVA_TOOL_OPTIONS="-javaagent:PATH/TO/opentelemetry-javaagent.jar"
Set Up Instrumentation
To set up the instrumentation and use the APIs for manual instrumentation, follow these steps from the see OpenTelemetry’s documentation of Instrumentation ecosystem:
-
Initialize the SDK
-
Initialize tracing
-
Create spans
Instrumentation Libraries
OpenTelemetry Java can automatically instrument and support a number of libraries, frameworks, and application servers. We recommend that you review the available OpenTelemetry Libraries and Frameworks.
Examples
You can use a set of fully-functional, working examples of OpenTelemetry Java APIs and SDK from Java OpenTelemetry Examples. You can run them locally.