OpenTelemetry auto-instrumentation and instrumentation libraries for Java
Go to file
Trask Stalnaker ea74337c10
Redo log capture instrumentation (#212)
Make it clear that this is experimental option, as the specifics of log
capture will definitely change sometime in the future once there is an
agreed on OpenTelemetry spec for this.

Capture logs as spans, to avoid the limitations of current
implementation that captures them as events (no log capture when no
current span, and limited number of events per span).

Change the log instrumentation module names to just reflect the
underlying logger, e.g. "log4j-1.1" instead of "log4j-spans-1.1". This
way we don't end up with an entirely deprecated artifact once the
logging spec is worked out. The spans instrumentation now shares modules
with the MDC instrumentation, which I think is reasonable, as you pick
which one you want via configuration.
2020-03-06 13:05:44 -08:00
.circleci Rename java agent artifact (#137) 2020-02-06 16:03:24 -08:00
agent-bootstrap Redo log capture instrumentation (#212) 2020-03-06 13:05:44 -08:00
agent-tooling Merge tag 'v0.45.0' into dd-merge 2020-03-05 21:49:39 -08:00
benchmark Merge tag 'v0.45.0' into dd-merge 2020-03-05 21:49:39 -08:00
benchmark-integration Add license headers (#188) 2020-02-27 13:24:42 -08:00
buildSrc Remove a couple remaining dd prefixes (#170) 2020-02-18 11:55:56 -08:00
exporter-adapters Add license headers (#188) 2020-02-27 13:24:42 -08:00
exporter-support Add license headers (#188) 2020-02-27 13:24:42 -08:00
gradle Add license headers (#188) 2020-02-27 13:24:42 -08:00
instrumentation Redo log capture instrumentation (#212) 2020-03-06 13:05:44 -08:00
java-agent Add license headers (#188) 2020-02-27 13:24:42 -08:00
load-generator Add license headers (#188) 2020-02-27 13:24:42 -08:00
logback-shaded-for-instrumenting Capture Logback events (#183) 2020-02-24 12:19:30 -08:00
opentelemetry-api-shaded-for-instrumenting Add instrumentation for OpenTelemetry API itself (#153) 2020-02-21 09:10:01 -08:00
opentelemetry-sdk-shaded-for-testing Rename boostrap and tooling modules (#146) 2020-02-07 17:01:55 -08:00
smoke-tests Merge tag 'v0.45.0' into dd-merge 2020-03-05 21:49:39 -08:00
testing Redo log capture instrumentation (#212) 2020-03-06 13:05:44 -08:00
utils Add license headers (#188) 2020-02-27 13:24:42 -08:00
.editorconfig Apply and enforce google checkstyle and formatting 2017-07-12 07:47:19 -07:00
.gitignore Merge remote-tracking branch 'datadog/master' into dd-merge 2020-02-22 14:35:03 -08:00
CODEOWNERS Update Seva's github username (#35) 2019-12-04 13:04:17 -08:00
CONTRIBUTING.md Merge tag 'v0.45.0' into dd-merge 2020-03-05 21:49:39 -08:00
LICENSE Update to standard LICENSE file for OpenTelemetry (#19) 2019-11-19 09:46:10 -08:00
LICENSE-3rdparty.csv Rename package to io.opentelemetry.auto (#54) 2020-01-14 13:57:01 -08:00
NOTICE Create NOTICE 2017-07-13 10:16:04 -04:00
README.md Replace wrong ota.jaeger.service by ota.service in documentation (#187) 2020-02-26 09:04:33 -08:00
gradle.properties Try doubling the metaspace size to fix check task. 2019-01-04 13:43:40 -08:00
gradlew Upgradle to gradle 6.0 2019-11-12 16:26:46 -05:00
gradlew.bat Update gradle to 5.5.1 2019-07-12 10:07:08 -04:00
settings.gradle Redo log capture instrumentation (#212) 2020-03-06 13:05:44 -08:00
trace-java.gradle Add license headers (#188) 2020-02-27 13:24:42 -08:00

README.md

OpenTelemetry Auto-Instrumentation for Java

Notice - Work in Progress!

This project is still in the early phases of development and is not yet stable. You are welcome to experiment with it, but we strongly discourage any production use!

Introduction

This project uses a technique known as bytecode instrumentation to add tracing to a Java application. Simply put, we provide a Java agent that can be attached to any Java 7+ application and dynamically adds code to enable tracing.

Using the agent

As mentioned above, this project is in a very early phase of development and not yet stable. However, you can try it on your Java application by following these instructions.

Download and run

Download the latest release.

The instrumentation agent is enabled using the -javaagent flag to the JVM. Configuration parameters are passed as Java system properties (-D flags) or as environment variables. This is an example:

java -javaagent:/path/to/opentelemetry-auto-<version>.jar \
     -Dota.exporter.jar=exporter-adapters/logging-exporter-adapter/build/libs/logging-exporter-adapter-0.1.2-SNAPSHOT.jar \
     -Dota.jaeger.host=localhost \
     -Dota.jaeger.port=14250 \
     -Dota.service=shopping \
     -jar myapp.jar

Configuration parameters (subject to change!)

System property Environment variable Purpose
ota.exporter.jar OTA_EXPORTER_JAR The path to an exporter JAR
ota.service OTA_SERVICE The service name of this JVM instance. This is used as a label in Jaeger to distinguish between JVM instances in a multi-service environment.

Available exporters

Currently two exporters are available and bundled with this project. They area available under the exporter-adapters directory.

Logging Exporter

The logging exporter simply prints the name of the span along with its attributes to stdout. It is used manly for testing and debugging. It takes a single configuration parameter.

System property Environment variable Purpose
ota.exporter.logging.prefix OTA_EXPORTER_LOGGING_PREFIX A string that is printed in front of the span name and attributes.

Jaeger exporter

A simple wrapper for the Jaeger exporter of opentelemetry-java. It currently only supports gRPC as its communications protocol.

System property Environment variable Purpose
ota.exporter.jaeger.host OTA_EXPORTER_JAEGER_HOST The Jaeger host to connect to. Currently only gRPC is supported.
ota.exporter.jaeger.port OTA_EXPORTER_JAEGER_PORT The port to connect to on the Jaeger host. Currently only gRPC is supported

These 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 may find.

Building from source

Build using Java 8:

gradle assemble

and then you can find the java agent artifact at java-agent/build/lib/opentelemetry-auto-<version>.jar.