
- Automatic instrumentation for many common libraries and frameworks
- Out-of-the-box traces and metrics for typical app building blocks
- Minimal or no code changes required to obtain telemetry
- Tracing incoming and outgoing HTTP requests
- Capturing database queries and connection metadata
- Tracking messaging events (Kafka, JMS, RabbitMQ, etc.)

- Repository: open-telemetry/opentelemetry-java-instrumentation
- Releases page (download the
opentelemetry-javaagent.jar): https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases
- JVM system properties (
-Dflags) — useful for direct JVM launches and fine-grained control. - Environment variables (
OTEL_*) — recommended in containerized environments (Docker, Kubernetes).
For container deployments, environment variables (
OTEL_*) are generally preferable to JVM -D properties because they integrate cleanly with container orchestration, secrets, and configuration management.- System properties using
-Dotel.*JVM flags - Environment variables using
OTEL_*names

| Setting | Purpose | Example |
|---|---|---|
OTEL_SERVICE_NAME | Service name shown in backends | OTEL_SERVICE_NAME=my-service |
otel.resource.attributes / OTEL_RESOURCE_ATTRIBUTES | Additional resource key=value attributes | -Dotel.resource.attributes=environment=prod,team=payments |
OTEL_TRACES_EXPORTER | Choose traces exporter (e.g., otlp, zipkin, jaeger) | OTEL_TRACES_EXPORTER=otlp |
OTEL_PROPAGATORS | Configure context propagation (e.g., tracecontext,baggage) | OTEL_PROPAGATORS=tracecontext,baggage |
OTEL_TRACES_SAMPLER | Sampling strategy (always_on, traceidratio, etc.) | OTEL_TRACES_SAMPLER=traceidratio |
OTEL_TRACES_SAMPLER_ARG | Sampler argument (e.g., ratio) | OTEL_TRACES_SAMPLER_ARG=0.1 |
OTEL_SDK_DISABLED | Disable the SDK entirely (useful for tests) | OTEL_SDK_DISABLED=true |



- Add or configure span processors, exporters, samplers, or propagators
- Inject new instrumentation modules for libraries not yet supported
- Modify or filter span attributes (for example, mask sensitive data)
- Disable or override existing instrumentation behavior
otel.javaagent.extensions system property:
- Disable spans to reduce noise and storage usage
- Normalize attribute names across services
- Mask or remove PII before exporting spans
- Add support for an in-house library that the agent does not yet instrument

Do not confuse Java agent extensions with OpenTelemetry Collector extensions — they are different concepts in different components. Collector extensions apply to the Collector pipeline, while Java agent extensions modify agent behavior inside the JVM.
- Automatic instrumentation is ideal for broad coverage with minimal effort.
- Use manual instrumentation (OpenTelemetry API) for business-specific spans and fine-grained telemetry.
- Prefer environment variables in containerized environments for easier integration with orchestration and secrets.
- Keep an eye on sampling and cardinality limits to control backend costs and performance.

- OpenTelemetry Java instrumentation repository: https://github.com/open-telemetry/opentelemetry-java-instrumentation
- OpenTelemetry Java instrumentation releases: https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases
- Agent documentation and configuration: https://opentelemetry.io/docs/instrumentation/java/