Skip to content

Java OpenTelemetry instrumentation

Osuite collects Java telemetry over OpenTelemetry. There are two supported paths, and most services should start with the first:

  • The OpenTelemetry Java agent (opentelemetry-javaagent.jar) — the primary path. A single -javaagent flag instruments your application at startup with no code changes and no rebuild. It covers the widest set of frameworks, HTTP clients, database drivers, and messaging libraries.
  • The OpenTelemetry Spring Boot starter — a build dependency for Spring Boot services that prefer to ship instrumentation inside the application artifact instead of attaching an agent. It is also the path to use when the Java agent cannot run, such as GraalVM native images.

This page covers the Java agent. For framework-specific setup, see the Spring Boot and Quarkus guides.

  • A running Java application (JDK 8 or newer).
  • Your Osuite ingest endpoint and token. The endpoint is ingest.<region>.osuite.io:443 for your region; the token is your <your-ingest-token>.
  • Outbound network access from the application host to the ingest endpoint on port 443.

The agent reads its configuration from environment variables. Three are required in every deployment:

  • OTEL_EXPORTER_OTLP_ENDPOINT — where telemetry is sent.
  • OTEL_EXPORTER_OTLP_HEADERS — carries your ingest token.
  • OTEL_SERVICE_NAME — identifies the service (service.name).
  • OTEL_RESOURCE_ATTRIBUTES — identifies its environment (service.environment).

Pick your deployment target. Every tab is a complete, self-contained path.

Download the agent, set the environment, and attach it with -javaagent:

Terminal window
curl -L -o opentelemetry-javaagent.jar \
https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
export OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.<region>.osuite.io:443"
export OTEL_EXPORTER_OTLP_PROTOCOL="grpc"
export OTEL_EXPORTER_OTLP_HEADERS="x-osuite-ingest-token=<your-ingest-token>"
export OTEL_SERVICE_NAME="my-service"
export OTEL_RESOURCE_ATTRIBUTES="service.environment=production"
java -javaagent:./opentelemetry-javaagent.jar -jar app.jar

The -javaagent flag must come before -jar.

The agent works with any JVM framework out of the box. These guides cover framework-specific configuration and the alternative starter and extension paths:

  • Spring Boot — the Java agent and the opentelemetry-spring-boot-starter.
  • Quarkus — the native quarkus-opentelemetry extension.

To add your own spans on top of the automatic instrumentation, see Custom instrumentation.

What you should see

Start the application and send it some traffic. The service appears in APM within a minute, emitting request-rate, error-rate, and latency metrics, and its requests show up as traces in the trace explorer.

If no data arrives, work through the Java-specific checks in Java troubleshooting.