java agent代码

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

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!