OpenTelemetry auto-instrumentation and instrumentation libraries for Java
Go to file
Gregor Zeitlinger 2642301afb fix test 2025-09-05 13:31:08 +02:00
.githooks
.github chore: add workflow for surveys of non-members (#14581) 2025-09-04 18:37:59 -07:00
benchmark-jfr-analyzer
benchmark-overhead chore(deps): update dependency gradle to v9 (#14355) 2025-08-27 07:26:25 -07:00
benchmark-overhead-jmh fix(deps): update dependency org.springframework.boot:spring-boot-starter-web to v3.5.5 (#14483) 2025-08-21 23:01:22 +03:00
bom
bom-alpha
buildscripts Split out camel experimental assertions (#14433) 2025-08-15 10:12:44 -07:00
conventions fix(deps): update dependency io.netty:netty-bom to v4.1.126.final (#14576) 2025-09-03 22:51:53 +03:00
custom-checks fix(deps): update errorproneversion to v2.41.0 (minor) (#14331) 2025-07-28 10:38:51 -07:00
declarative-config-bridge move Declarative config bridge to a dedicated module (#14548) 2025-09-05 02:26:04 +00:00
dependencyManagement fix(deps): update dependency io.opentelemetry.proto:opentelemetry-proto to v1.8.0-alpha (#14572) 2025-09-03 08:13:59 +03:00
docs gRPC Metadata (#14573) 2025-09-04 09:21:31 +03:00
examples fix(deps): update dependency io.opentelemetry.proto:opentelemetry-proto to v1.8.0-alpha (#14572) 2025-09-03 08:13:59 +03:00
gradle/wrapper chore(deps): update dependency gradle to v9 (#14355) 2025-08-27 07:26:25 -07:00
gradle-plugins chore(deps): update plugin com.gradle.plugin-publish to v2 (#14577) 2025-09-04 09:13:56 +03:00
instrumentation make xxl-job indy-ready (#14571) 2025-09-04 12:03:13 +03:00
instrumentation-annotations chore(deps): update dependency gradle to v9 (#14355) 2025-08-27 07:26:25 -07:00
instrumentation-annotations-support
instrumentation-annotations-support-testing semconv stable code (#13860) 2025-06-24 21:00:39 -07:00
instrumentation-api Require db methods (#14460) 2025-08-20 09:33:07 -07:00
instrumentation-api-incubator move Declarative config bridge to a dedicated module (#14548) 2025-09-05 02:26:04 +00:00
instrumentation-docs Metadata - Add new header exclusion (#14553) 2025-09-04 14:56:43 -07:00
javaagent move Declarative config bridge to a dedicated module (#14548) 2025-09-05 02:26:04 +00:00
javaagent-bootstrap Add constructor to AgentClassLoader for custom parent ClassLoader (#14480) 2025-09-02 14:34:13 +03:00
javaagent-extension-api make declarative config bridge usable by spring starter and contrib (#14497) 2025-08-28 08:45:17 -07:00
javaagent-internal-logging-application
javaagent-internal-logging-simple
javaagent-tooling add declarative config span logger 2025-09-05 12:03:36 +02:00
licenses fix(deps): update jackson packages to v2.20.0 (minor) (#14545) 2025-08-31 13:04:56 +03:00
muzzle fix(deps): update errorproneversion to v2.41.0 (minor) (#14331) 2025-07-28 10:38:51 -07:00
opentelemetry-api-shaded-for-instrumenting Update the OpenTelemetry SDK version to 1.52.0 (#14231) 2025-07-15 08:09:18 -07:00
opentelemetry-ext-annotations-shaded-for-instrumenting
opentelemetry-instrumentation-annotations-shaded-for-instrumenting
opentelemetry-instrumentation-api-shaded-for-instrumenting
sdk-autoconfigure-support Spring starter thread details (#14449) 2025-08-22 07:32:48 -07:00
smoke-tests fix(deps): update armeria packages to v1.33.2 (patch) (#14539) 2025-08-28 13:59:27 +03:00
smoke-tests-otel-starter chore(deps): update dependency gradle to v9 (#14355) 2025-08-27 07:26:25 -07:00
test-report fix(deps): update dependency com.google.auth:google-auth-library-oauth2-http to v1.39.0 (#14585) 2025-09-05 07:28:43 +03:00
testing fix test 2025-09-05 13:31:08 +02:00
testing-common fix test 2025-09-05 13:31:08 +02:00
.clomonitor.yml
.editorconfig
.fossa.yml move Declarative config bridge to a dedicated module (#14548) 2025-09-05 02:26:04 +00:00
.gitattributes
.gitignore
.java-version
.lychee.toml Make it easier to run lychee locally (#14155) 2025-06-30 16:26:26 -07:00
CHANGELOG.md Fix dropwizard-views configuration (#14475) 2025-08-20 17:30:48 +00:00
CONTRIBUTING.md
ISSUES.md
LICENSE
README.md Update Jay DeLuca company affiliation (#14177) 2025-07-03 14:40:23 +03:00
RELEASING.md
VERSIONING.md
build.gradle.kts Fix running ./gradlew tasks (#14407) 2025-08-11 12:26:02 -07:00
code-of-conduct.md
gradle.properties
gradlew chore(deps): update dependency gradle to v9 (#14355) 2025-08-27 07:26:25 -07:00
gradlew.bat
settings.gradle.kts move Declarative config bridge to a dedicated module (#14548) 2025-09-05 02:26:04 +00:00
version.gradle.kts Update version to 2.20.0-SNAPSHOT (#14446) 2025-08-15 23:21:54 +00:00

README.md

OpenTelemetry Instrumentation for Java

Release OpenSSF Scorecard Slack

About

This project provides a Java agent JAR that can be attached to any Java 8+ application and dynamically injects bytecode to capture telemetry from a number of popular libraries and frameworks. You can export the telemetry data in a variety of formats. You can also configure the agent and exporter via command line arguments or environment variables. The net result is the ability to gather telemetry data from a Java application without code changes.

This repository also publishes standalone instrumentation for several libraries (and growing) that can be used if you prefer that over using the Java agent. Please see the standalone library instrumentation column on Supported Libraries. If you are looking for documentation on using those.

Getting Started

Download the latest version.

This package includes the instrumentation agent as well as instrumentations for all supported libraries and all available data exporters. The package provides a completely automatic, out-of-the-box experience.

Enable the instrumentation agent using the -javaagent flag to the JVM.

java -javaagent:path/to/opentelemetry-javaagent.jar \
     -jar myapp.jar

By default, the OpenTelemetry Java agent uses the OTLP exporter configured to send data to an OpenTelemetry collector at http://localhost:4318.

Configuration parameters are passed as Java system properties (-D flags) or as environment variables. See the configuration documentation for the full list of configuration items. For example:

java -javaagent:path/to/opentelemetry-javaagent.jar \
     -Dotel.resource.attributes=service.name=your-service-name \
     -Dotel.traces.exporter=zipkin \
     -jar myapp.jar

Configuring the Agent

The agent is highly configurable! Many aspects of the agent's behavior can be configured for your needs, such as exporter choice, exporter config (like where data is sent), trace context propagation headers, and much more.

For a detailed list of agent configuration options, see the agent configuration docs.

For a detailed list of additional SDK configuration environment variables and system properties, see the SDK configuration docs.

Note: Config parameter names are very likely to change over time, so please check back here when trying out a new version! Please report any bugs or unexpected behavior you find.

Supported libraries, frameworks, and application servers

We support an impressively huge number of libraries and frameworks and a majority of the most popular application servers...right out of the box! Click here to see the full list and to learn more about disabled instrumentation and how to suppress unwanted instrumentation.

Creating agent extensions

Extensions add new features and capabilities to the agent without having to create a separate distribution or to fork this repository. For example, you can create custom samplers or span exporters, set new defaults, and embed it all in the agent to obtain a single jar file.

Creating an agent distribution

Distribution provides guidance on creating a separate distribution, serving as a collection of examples for extending the functionality of the OpenTelemetry Java instrumentation agent. It also demonstrates how to repackage the agent while incorporating custom features. Agent extensions are recommended instead for most users as they are simpler and do not require rebuilding with each OpenTelemetry Java agent release.

Manually instrumenting

For most users, the out-of-the-box instrumentation is completely sufficient and nothing more has to be done. Sometimes, however, users wish to add attributes to the otherwise automatic spans, or they might want to manually create spans for their own custom code.

For detailed instructions, see Manual instrumentation.

Logger MDC (Mapped Diagnostic Context) auto-instrumentation

It is possible to inject trace information like trace IDs and span IDs into your custom application logs. For details, see Logger MDC auto-instrumentation.

Troubleshooting

To turn on the agent's internal debug logging:

-Dotel.javaagent.debug=true

Note: These logs are extremely verbose. Enable debug logging only when needed. Debug logging negatively impacts the performance of your application.

Contributing

See CONTRIBUTING.md.

Maintainers

For more information about the maintainer role, see the community repository.

Approvers

For more information about the approver role, see the community repository.

Emeritus maintainers

For more information about the emeritus role, see the community repository.

Thanks to all of our contributors!

Repo contributors