OpenTelemetry Java Agent
Have you considered using the Lumigo OpenTelemetry Distro for Java?
The Lumigo OpenTelemetry Distro for Java is built on top of the OpenTelemetry Java SDK and the OpenTelemetry Java Agent, adding a number of functionalities from the opentelemetry-java-contrib repository, together with a lot of additional automation, no-code capabilities and automated quality-assurance.
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 your Lumigo token, which is available in Settings -> Tracing -> Manual tracing
, see the Lumigo Tokens documentation.
Resource Attributes are very important!
When you instantiate the
TracerProvider
, you can pass it aResource
, 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.
Updated about 1 year ago