java agent代码

Anuraag Agrawal 1d4c150111 Add task to generate license report into licenses folder. (#2239) před 4 roky
.githooks 4a943c8411 Use Spotless for formatting (DataDog/dd-trace-java#1619) před 4 roky
.github a8676e2bc8 Create draft release with uploaded agent in github workflow. (#2237) před 4 roky
benchmark 1ebb58a596 Update to SDK 0.15.0 (#2137) před 4 roky
benchmark-e2e 5bf9f34caa Bring org.testcontainers to 1.15.1 (#2178) před 4 roky
benchmark-integration afdde0355b Update to OTel 0.14.1 (#2059) před 4 roky
buildSrc 2d683d4289 No more gradle warnings (#2103) před 4 roky
docs ca21955bd9 README and docs reorg (#2226) před 4 roky
examples c91bff41cb Add comment about extension shading (#2235) před 4 roky
gradle c91bff41cb Add comment about extension shading (#2235) před 4 roky
instrumentation 66fe53b028 Remove deps from javaagent (#2251) před 4 roky
instrumentation-api ecf64c25f3 Remove BaseTracer#startScope() method (#2224) před 4 roky
instrumentation-core fc410706d0 Update to Sdk 0.16.0 (#2221) před 4 roky
javaagent c91bff41cb Add comment about extension shading (#2235) před 4 roky
javaagent-api 27d5786d65 Allow getting current call depth (#2184) před 4 roky
javaagent-bootstrap 2d683d4289 No more gradle warnings (#2103) před 4 roky
javaagent-spi 1ebb58a596 Update to SDK 0.15.0 (#2137) před 4 roky
javaagent-tooling 1d4c150111 Add task to generate license report into licenses folder. (#2239) před 4 roky
licenses 1d4c150111 Add task to generate license report into licenses folder. (#2239) před 4 roky
load-generator afdde0355b Update to OTel 0.14.1 (#2059) před 4 roky
opentelemetry-api-shaded-for-instrumenting afdde0355b Update to OTel 0.14.1 (#2059) před 4 roky
opentelemetry-ext-annotations-shaded-for-instrumenting a3d11c0262 Rename auto annotations to ext annotations (#1799) před 4 roky
smoke-tests 5dc2cd420a Start smoke test backend and collector only once (#2249) před 4 roky
testing c91bff41cb Add comment about extension shading (#2235) před 4 roky
testing-common 49206212cf Refactor AgentTestRunner: extract a common interface, convert to Java class (#2223) před 4 roky
.editorconfig 21a1c65128 Remove inner class imports; avoid future imports by disabling in editorconfig (#1489) před 4 roky
.gitattributes 1d4c150111 Add task to generate license report into licenses folder. (#2239) před 4 roky
.gitignore a6e0e27ad4 Remove usage of Contexts from grpc instrumentation. (#1426) před 4 roky
CONTRIBUTING.md f738a158c2 fix the branch master to main (#2225) před 4 roky
LICENSE f2f89a5e22 Update to standard LICENSE file for OpenTelemetry (#19) před 5 roky
README.md 6cc408f1a1 Add @mateuszrzeszutek as maintainer (#2246) před 4 roky
RELEASING.md 640a7d624b Correct some spelling mistakes (#2025) před 4 roky
build.gradle d7183ebbdc Add a simple description to POM. (#1857) před 4 roky
gradle.properties 2d683d4289 No more gradle warnings (#2103) před 4 roky
gradlew 9cd2d627ca Upgrade to Gradle 6.6 (#1073) před 4 roky
gradlew.bat 9cd2d627ca Upgrade to Gradle 6.6 (#1073) před 4 roky
settings.gradle fc410706d0 Update to Sdk 0.16.0 (#2221) před 4 roky

README.md


Getting Started   •   Getting Involved   •   Getting In Touch

Build Status GitHub release (latest by date including pre-releases) Beta

Contributing   •   Scope   •   Roadmap


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.

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-all.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 below for a full list of environment variables. For example:

java -javaagent:path/to/opentelemetry-javaagent-all.jar \
     -Dotel.trace.exporter=zipkin \
     -jar myapp.jar

Specify the external exporter JAR file using the otel.exporter.jar system property:

java -javaagent:path/to/opentelemetry-javaagent-all.jar \
     -Dotel.exporter.jar=path/to/external-exporter.jar \
     -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.

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.

See here for detailed instructions.

Logger MDC (Mapped Diagnostic Context) auto-instrumentation

It is possible to inject trace information like trace id and span id into your custom application logs.

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.

Roadmap to 1.0 (GA)

See GA Requirements

Contributing

See CONTRIBUTING.md.

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

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

Learn more about roles in the community repository.

Thanks to all the people who already contributed!