OpenTelemetry auto-instrumentation and instrumentation libraries for Java
Go to file
renovate[bot] e83c5a32c4
chore(deps): update actions/upload-artifact action to v4.3.4 (main) (#11748)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-05 16:13:09 +00:00
.githooks Use Spotless for formatting (DataDog/dd-trace-java#1619) 2020-06-30 11:15:48 -07:00
.github chore(deps): update actions/upload-artifact action to v4.3.4 (main) (#11748) 2024-07-05 16:13:09 +00:00
benchmark-jfr-analyzer Remove unshaded javax.annotation classes from bootstrap class loader (#4454) 2021-10-21 14:47:50 -07:00
benchmark-overhead Fix collector conf for overhead tests (#11730) 2024-07-03 19:23:19 +03:00
benchmark-overhead-jmh fix(deps): update dependency org.springframework.boot:spring-boot-starter-web to v3.3.1 (main) (#11644) 2024-06-20 08:08:39 -07:00
bom Update SDK version (#7223) 2022-11-18 18:13:39 +00:00
bom-alpha Add semconv to alpha bom (#9425) 2023-09-14 01:54:25 +00:00
buildscripts Fix package name in owasp suppression (#10838) 2024-03-13 18:35:25 +02:00
conventions fix(deps): update dependency org.owasp:dependency-check-gradle to v10.0.1 (main) (#11722) 2024-07-03 09:25:58 +03:00
custom-checks Build with jdk21 (#11219) 2024-05-01 07:17:21 -07:00
dependencyManagement fix(deps): update dependency org.codehaus.mojo:animal-sniffer-annotations to v1.24 (main) (#11741) 2024-07-05 09:25:51 +03:00
docs add javalin instrumentation (#11587) 2024-07-01 16:41:04 +03:00
examples fix(deps): update dependency io.opentelemetry.proto:opentelemetry-proto to v1.3.2-alpha (main) (#11715) 2024-07-02 10:19:44 +03:00
gradle/wrapper chore(deps): update dependency gradle to v8.8 (main) (#11510) 2024-06-01 13:23:28 +03:00
gradle-plugins fix(deps): update junit5 monorepo to v5.10.3 (main) (patch) (#11681) 2024-06-27 18:00:18 -07:00
instrumentation Replace junit4 @Test annotation with junit5 annotation (#11745) 2024-07-05 16:38:54 +03:00
instrumentation-annotations AddingSpanAttributes annotation (#7787) 2023-04-24 08:58:28 -07:00
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 Allow configuring MDC key names for trace_id, span_id, trace_flags (#11329) 2024-06-10 12:37:22 -07:00
instrumentation-api-incubator config properties support for spring starter clients (#11605) 2024-07-02 16:49:39 +03:00
javaagent Fix task ordering problem between `SpdxSbomTask` and `Sign` when publishing (#11444) 2024-05-23 13:15:24 -07:00
javaagent-bootstrap Improve security manager support (#11466) 2024-05-29 09:11:22 +03:00
javaagent-extension-api config properties support for spring starter clients (#11605) 2024-07-02 16:49:39 +03:00
javaagent-internal-logging-application Fix flaky application logging test (#9341) 2023-08-30 10:46:16 +00:00
javaagent-internal-logging-simple Reduce logging from okhttp3.internal.concurrent.TaskRunner (#9814) 2023-11-07 12:15:12 +01:00
javaagent-tooling config properties support for spring starter clients (#11605) 2024-07-02 16:49:39 +03:00
licenses Update the OpenTelemetry SDK version to 1.39.0 (#11540) 2024-06-11 14:07:25 +03:00
muzzle config properties support for spring starter clients (#11605) 2024-07-02 16:49:39 +03:00
opentelemetry-api-shaded-for-instrumenting Update the OpenTelemetry SDK version to 1.38.0 (#11335) 2024-05-15 11:07:50 -07:00
opentelemetry-ext-annotations-shaded-for-instrumenting Support new annotations (and change of instrumentation name for opentelemetry-annotations) (#6296) 2022-07-11 14:34:26 -07:00
opentelemetry-instrumentation-annotations-shaded-for-instrumenting Support new annotations (and change of instrumentation name for opentelemetry-annotations) (#6296) 2022-07-11 14:34:26 -07:00
opentelemetry-instrumentation-api-shaded-for-instrumenting Instrument SpanKey directly (#5933) 2022-05-03 14:56:33 -07:00
sdk-autoconfigure-support Cloud provider in spring starter (#11014) 2024-04-11 15:03:17 -07:00
smoke-tests fix(deps): update quarkus packages to v3.12.1 (main) (patch) (#11732) 2024-07-03 19:23:40 +03:00
smoke-tests-otel-starter Fix GraalVM hint (#11737) 2024-07-04 12:19:28 +03:00
testing fix(deps): update armeria packages to v1.29.1 (main) (patch) (#11686) 2024-06-28 09:38:43 +03:00
testing-common Add http/2 tests for jdk http client (#11506) 2024-06-01 11:20:45 +03:00
.editorconfig Bump spotless-plugin-gradle from 6.12.1 to 6.13.0 (#7591) 2023-01-17 19:43:46 -08:00
.gitattributes Add task to generate license report into licenses folder. (#2239) 2021-02-12 17:20:08 +09:00
.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 Introduce markdown lint check (#7175) 2022-11-16 20:48:42 -08:00
CHANGELOG.md Merge change log updates from release/v1.33.x (#11628) 2024-06-19 15:02:45 +03:00
CONTRIBUTING.md Build with jdk21 (#11219) 2024-05-01 07:17:21 -07:00
ISSUES.md Issue label update (#9292) 2023-08-24 12:53:54 +03:00
LICENSE
README.md Add new triagers (#11584) 2024-06-13 18:35:00 +03:00
RELEASING.md Update RELEASING.md (#10226) 2024-01-15 12:48:46 +02:00
VERSIONING.md Apply Prettier to markdown files (#8968) 2023-07-19 12:22:35 -07:00
build.gradle.kts Fix running ./gradlew tasks (#11692) 2024-06-28 17:11:39 +03:00
code-of-conduct.md Add code-of-conduct file. (#2341) 2021-02-19 16:24:41 +09:00
gradle.properties Remove workaround (#7533) 2023-01-10 14:07:09 +01:00
gradlew chore(deps): update dependency gradle to v8.8 (main) (#11510) 2024-06-01 13:23:28 +03:00
gradlew.bat chore(deps): update dependency gradle to v8.7 (main) (#10939) 2024-03-23 09:32:06 +02:00
settings.gradle.kts add javalin instrumentation (#11587) 2024-07-01 16:41:04 +03:00
version.gradle.kts Update version to 2.6.0-SNAPSHOT (#11596) 2024-06-17 09:02:58 -07: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 including pre-releases)" src="https://img.shields.io/github/v/release/open-telemetry/opentelemetry-java-instrumentation?include_prereleases&style=for-the-badge"> </a> <img alt="Beta" src="https://img.shields.io/badge/status-beta-informational?style=for-the-badge&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAACQAAAAAQAAAJAAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAABigAwAEAAAAAQAAABgAAAAA8A2UOAAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQA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xdH2Z3x+VTVYsPb+O0C/9/auN6v2hNZw5b2UOmSbG5/rkC3LBA+1PdxFxORjxpQ81GcxKc+ybVjEBvUJvaGJ7p7n5A5KSwe4AzkasA+crmzFtowoIVTiLjANm8GDsrWW35ScI3JY8Urv83tnkF8JR0yLvEt2hO/0qNyy3Jb3YKeHeHeLeOuVLRpNF+pkf85OW7/zJxWdXsbsKBUk2TC0BCPwMq5Q/CPvaJFkNS/1l1qUPe+uH3oD59erYGI/Y4sce6KaXYElAIOLt+0O3t2+/xJDF1XvOlWGC1W1B8VMszbGfOvT5qaRRAIFK3BCO164nZ0uYLH2YjNN8thXS2v2BK9gTfD7jHVxzHr4roOlEvYYz9QIz+Vl/sLDXInsctFsXjqIRnO2ZO387lxmIboLDZCJ59KLFliNIgh9ipt6tLg9SihpRPDO1ia5byw7de1aCQmF5geOQtK509rzfdwxaKOIq+73AvwCC5/5fcV4vo3+3LpMdtWHh0ywsJC/ZGoCb8/9D8F/ifgLLl8S8QWfU8cAAAAASUVORK5CYII="> </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 including pre-releases) Beta

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.

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 OTLP exporter configured to send data to OpenTelemetry collector at http://localhost:4317.

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.

Click here to see the detailed list of configuration environment variables and system properties.

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!