Extensions add new features and capabilities to the agent without having to create a separate distribution (for examples and ideas, see Use cases for extensions).
The contents in this folder demonstrate how to create an extension for the OpenTelemetry Java instrumentation agent, with examples for every extension point.
Read both the source code and the Gradle build script, as they contain documentation that explains the purpose of all the major components.
To build this extension project, run ./gradlew build
. You can find the resulting jar file in build/libs/
.
To add the extension to the instrumentation agent:
-
Copy the jar file to a host that is running an application to which you've attached the OpenTelemetry Java instrumentation.
-
Modify the startup command to add the full path to the extension file. For example:
java -javaagent:path/to/opentelemetry-javaagent.jar \ -Dotel.javaagent.extensions=build/libs/opentelemetry-java-instrumentation-extension-demo-1.0-all.jar -jar myapp.jar
Note: to load multiple extensions, you can specify a comma-separated list of extension jars or directories (that
contain extension jars) for the otel.javaagent.extensions
value.
Grab the version you want to release from S3 and create a new GitHub release and attach the jar as a release binary.