Java

Auto instrument your Java application using opentelemetry-java-instrumentation and send traces to Aspecto's collector.

Installation

Download the latest Java agent 'JAR' from the official repo in github and copy the opentelemetry-javaagent-all.jar file to your project.

Run Your App With Auto Instrumentation

You'll need to set up the following environment variables to export traces to Aspecto:

  • OTEL_SERVICE_NAME - set to the name of the service

  • OTEL_EXPORTER_OTLP_HEADERS - set to Authorization=${YOUR_ASPECTO_TOKEN} . You can get your token here.

  • OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - set to https://otelcol.aspecto.io:4317

Once finished, load the agent to your application using the -javaagent option:

java -javaagent:/path/to/the/downloaded/opentelemetry-javaagent-all.jar -jar your-app.jar

Last updated