Skip to content

mypulse-uk/otel-extension

Repository files navigation

Extensions

Introduction

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.

Build and add extensions

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:

  1. Copy the jar file to a host that is running an application to which you've attached the OpenTelemetry Java instrumentation.

  2. 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.

Releasing

Grab the version you want to release from S3 and create a new GitHub release and attach the jar as a release binary.