Migrate Java OpenTelemetry APM :: Kloudfuse Docs

Migrate 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"
    ```

Copied!

## 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](https://opentelemetry.io/docs/languages/java/instrumentation/#initialize-the-sdk):

1. Initialize the SDK
2. Initialize tracing
3. 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](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md#libraries%E2%80%94%E2%80%8Bframeworks).

## Examples

You can use a set of fully-functional, working examples of OpenTelemetry Java APIs and SDK from [Java OpenTelemetry Examples](https://github.com/open-telemetry/opentelemetry-java-examples#java-opentelemetry-examples). You can run them locally.