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!