OpenTelemetry Java Agent

Overview

The steps to make the OpenTelemetry Java Agent report tracing data to Lumigo are a mix of adding the OpenTelemetry Java agent at runtime and environment-based configuration.

This documentation does not cover how to add instrumentation to your Python code, but pointers are provided in the "What's Next" section at the end of the page.

Add the Java agent

The OpenTelemetry Java Instrumentation project makes available a Java agent that automatically instruments Java applications. The latest release is available in the GitHub releases, as the opentelemetry-javaagent.jar file.

Adding the OpenTelemetry Java Agent to a Java application requires passing the -javaagent:<path/to/opentelemetry-javaagent.jar> as a startup parameter. For example, if you want to run the app.jar executable JAR file and your agent file is available at /opt/opentelemetry/java/opentelemetry-javaagent.jar, the startup parameters would look like:

java -javaagent:opentelemetry-javaagent.jar -jar app.jar

📘

Mind the order of parameters!

The -javaagent parameter must be specified before -jar.

With the OpenTelemetry Java Agent added at startup to your application, the nest step is to configure it via environment variables.

Configure the OpenTelemetry Java Agent

The OpenTelemetry OTLP Exporters package of the OpenTelemetry Python SDK can be connected to Lumigo using the following environment variables:

Environment variable

Value

Notes

OTEL_EXPORTER_OTLP_TRACES_ENDPOINT

https://ga-otlp.lumigo-tracer-edge.golumigo.com/v1/traces

OTEL_EXPORTER_OTLP_HEADERS

Authorization=LumigoToken <token>

OTEL_EXPORTER_OTLP_PROTOCOL

http/protobuf

Not setting this variable will prevent tracing data to be reported to Lumigo!

Replace <token> with the token provided in Lumigo on the Settings -> Tracing -> Manual tracing screen.

📘

Resource Attributes are very important!

When you instantiate the TracerProvider, you can pass it a Resource, which contains attributes that describe the your Python application and the platform on which it runs. See the Supported Semantic Conventions page for a list of endorsed Resource Detectors that will provide data useful for your experience of using Lumigo.


Did this page help you?