OpenTelemetry auto-instrumentation and instrumentation libraries for Java
Go to file
Ivan Fernandez Calvo 47ada968e8
feat: ignore Byteman classes (#12914)
2024-12-18 11:03:45 -08:00
.githooks
.github chore(deps): update github/codeql-action action to v3.27.9 (#12897) 2024-12-16 09:51:53 +02:00
benchmark-jfr-analyzer
benchmark-overhead fix(deps): update junit5 monorepo to v5.11.4 (patch) (#12898) 2024-12-16 16:07:56 +00:00
benchmark-overhead-jmh fix(deps): update dependency org.springframework.boot:spring-boot-starter-web to v3.4.0 (#12767) 2024-11-22 10:20:48 -08:00
bom
bom-alpha Fix gradle deprecation warnings (#12864) 2024-12-09 07:46:07 -08:00
buildscripts Remove todo assignment (#12884) 2024-12-12 12:39:33 -08:00
conventions fix(deps): update dependency io.netty:netty-bom to v4.1.116.final (#12906) 2024-12-17 14:39:10 +02:00
custom-checks Support alternate internal javadoc comment for "experimental" classes (#12866) 2024-12-09 22:09:51 +00:00
dependencyManagement fix(deps): update guava packages to v33.4.0-jre (minor) (#12900) 2024-12-17 13:04:59 +02:00
docs Add docs section for instrumentation submodule naming convention (#12893) 2024-12-16 15:49:01 -08:00
examples fix(deps): update dependency ch.qos.logback:logback-classic to v1.5.13 (#12917) 2024-12-18 20:07:08 +02:00
gradle/wrapper chore(deps): update dependency gradle to v8.11.1 (#12758) 2024-11-20 11:32:08 -08:00
gradle-plugins Fix gradle deprecation warning (#12907) 2024-12-17 07:30:00 -08:00
instrumentation Fix test-latest-deps (#12909) 2024-12-18 08:18:59 +02:00
instrumentation-annotations
instrumentation-annotations-support Fix typo (#11672) 2024-06-27 09:14:22 +03:00
instrumentation-annotations-support-testing Semconv 1.25.0 migration (#10983) 2024-04-09 11:25:52 -07:00
instrumentation-api add db client metrics (#12806) 2024-11-28 08:13:10 -08:00
instrumentation-api-incubator Rename "db.client.connections.usage" to "db.client.connection.count" (#12886) 2024-12-14 11:55:58 +02:00
javaagent Remove public suffixes list from the agent (#10763) 2024-12-04 15:35:46 -08:00
javaagent-bootstrap make servlet3 + spring webmvc + jaxrs 2.0 indy compatible (#12432) 2024-11-29 18:48:46 -08:00
javaagent-extension-api Set up virtual field transforms before otel sdk is initialized (#12444) 2024-10-25 16:55:36 -07:00
javaagent-internal-logging-application Fix flaky application logging test (#9341) 2023-08-30 10:46:16 +00:00
javaagent-internal-logging-simple Update shadow plugin to new version and coordinates (#11979) 2024-08-09 09:40:04 +03:00
javaagent-tooling feat: ignore Byteman classes (#12914) 2024-12-18 11:03:45 -08:00
licenses fix(deps): update byte buddy packages to v1.15.11 (patch) (#12896) 2024-12-16 11:19:47 +02:00
muzzle Set up virtual field transforms before otel sdk is initialized (#12444) 2024-10-25 16:55:36 -07:00
opentelemetry-api-shaded-for-instrumenting Bridge more incubating api (#12230) 2024-09-24 07:51:59 +03:00
opentelemetry-ext-annotations-shaded-for-instrumenting Update shadow plugin to new version and coordinates (#11979) 2024-08-09 09:40:04 +03:00
opentelemetry-instrumentation-annotations-shaded-for-instrumenting Update shadow plugin to new version and coordinates (#11979) 2024-08-09 09:40:04 +03:00
opentelemetry-instrumentation-api-shaded-for-instrumenting Update shadow plugin to new version and coordinates (#11979) 2024-08-09 09:40:04 +03:00
sdk-autoconfigure-support add support for missing list properties in spring starter (#12434) 2024-10-16 08:00:57 -07:00
smoke-tests fix(deps): update dependency com.google.protobuf:protobuf-java-util to v4.29.2 (#12918) 2024-12-18 20:06:43 +02:00
smoke-tests-otel-starter add support for missing spring list properties (#12819) 2024-12-12 17:20:22 +02:00
testing fix(deps): update armeria packages to v1.31.3 (patch) (#12877) 2024-12-11 16:19:40 +02:00
testing-common Rename "db.client.connections.usage" to "db.client.connection.count" (#12886) 2024-12-14 11:55:58 +02:00
.editorconfig
.gitattributes
.gitignore ci: use .java-version (#11323) 2024-05-15 07:31:25 -07:00
.java-version ci: use .java-version (#11323) 2024-05-15 07:31:25 -07:00
.markdownlint.yml
CHANGELOG.md Change log - migration notes for v2.11.0 (#12867) 2024-12-17 07:35:35 -08:00
CONTRIBUTING.md Using copilot to help understand PR build failures (#12492) 2024-10-22 07:13:04 -07:00
ISSUES.md Issue label update (#9292) 2023-08-24 12:53:54 +03:00
LICENSE
README.md Update links in readme to new doc locations (#12546) 2024-11-04 08:57:10 -08:00
RELEASING.md Update release schedule (#12844) 2024-12-08 07:16:00 -08:00
VERSIONING.md
build.gradle.kts Don't write build scan link for the test partions task (#12335) 2024-09-26 12:16:57 +03:00
code-of-conduct.md
gradle.properties
gradlew chore(deps): update dependency gradle to v8.9 (main) (#11798) 2024-07-12 15:14:29 -07:00
gradlew.bat chore(deps): update dependency gradle to v8.9 (main) (#11798) 2024-07-12 15:14:29 -07:00
settings.gradle.kts fix(deps): update gradle develocity packages to v3.19 (minor) (#12882) 2024-12-12 17:12:27 +02:00
version.gradle.kts Update version to 2.11.0-SNAPSHOT (#12619) 2024-11-12 19:54:23 -08:00

README.md

<p align="center"> <strong> <a href="https://github.com/open-telemetry/opentelemetry-java-instrumentation#getting-started">Getting Started</a>   •   <a href="https://github.com/open-telemetry/community#special-interest-groups">Getting Involved</a>   •   <a href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/discussions">Getting In Touch</a> </strong> </p> <p align="center"> <a href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/build.yml"> <img alt="Build Status" src="https://img.shields.io/github/actions/workflow/status/open-telemetry/opentelemetry-java-instrumentation/build.yml?branch=main&style=for-the-badge"> </a> <a href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases"> <img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/open-telemetry/opentelemetry-java-instrumentation?style=for-the-badge"> </a> </p> <p align="center"> <strong> <a href="CONTRIBUTING.md">Contributing</a>   •   <a href="docs/scope.md">Scope</a> </strong> </p>

Getting Started   •   Getting Involved   •   Getting In Touch

Build Status GitHub release (latest by date)

Contributing   •   Scope

OpenTelemetry Icon OpenTelemetry Instrumentation for Java

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.

Note: There are 2.x releases and 1.x releases. The 2.0 release included significant breaking changes, the details of which can be found in the release notes. It is recommended to use the latest 2.x release which will have the latest features and improvements. 1.x will receive security patches for a limited time and will not include other bug fixes and enhancements.

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.

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.

Triagers (@open-telemetry/java-instrumentation-triagers):

Approvers (@open-telemetry/java-instrumentation-approvers):

Maintainers (@open-telemetry/java-instrumentation-maintainers):

Emeritus maintainers:

Learn more about roles in the community repository.

Thanks to all the people who already contributed!