Document the possibility to embed extension into agent jar (#3624)

This commit is contained in:
Nikita Salnikov-Tarnovski 2021-07-19 22:11:21 +03:00 committed by GitHub
parent af1aa540a2
commit 73ed96ab82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -29,6 +29,15 @@ java -javaagent:path/to/opentelemetry-javaagent-all.jar \
```
specifying the full path and the correct name of your extensions jar.
## Embedded extensions
It is also possible to embedded you extension archive right inside OpenTelemetry Java Agent.
This produces a single jar file thus simplifying deployment.
Please consult `extendedAgent` task in [build.gradle](build.gradle) file for more information.
When using Java Agent with embedded extension, the `-Dotel.javaagent.experimental.extensions`
command line option is not needed anymore.
Just `-javaagent` is sufficient.
## Extensions examples
* [DemoIdGenerator](src/main/java/com/example/javaagent/DemoIdGenerator.java) - custom `IdGenerator`
@ -44,7 +53,7 @@ specifying the full path and the correct name of your extensions jar.
There are several options to override or customise instrumentation provided by the upstream agent.
The following description follows one specific use-case:
> Instrumentation X from Otel distribution creates span that I don't like and I want to change it.
> Instrumentation X from OpenTelemetry distribution creates span that I don't like and I want to change it.
As an example, let us take some database client instrumentation that creates a span for database call
and extracts data from db connection to provide attributes for that span.