Add documentation to the Maven plugin for static instrumentation (#498)

This commit is contained in:
Jean Bisutti 2022-10-07 19:23:39 +02:00 committed by GitHub
parent dbbc66eee6
commit 66b99f12ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 5 deletions

View File

@ -4,15 +4,19 @@
### Agent instrumenter
Module enhancing OpenTelemetry Java Agent for static instrumentation. The modified agent can instrument and save a new JAR with all relevant instrumentations applied and necessary helper class-code included.
Module enhancing OpenTelemetry Java Agent for static instrumentation. The modified agent can
instrument and save a new JAR with all relevant instrumentations applied and necessary helper
class-code included.
#### Generate a new application jar containing the static instrumentation
Execute the following command line with your application jar name and the desired output folder of the new jar:
Execute the following command line with your application jar name and the desired output folder of
the new jar:
`java -javaagent:opentelemetry-static-agent.jar -cp <your-app.jar> io.opentelemetry.contrib.staticinstrumenter.agent.main.Main <output-folder>`
The `opentelemetry-static-agent.jar` agent needs to be both attached (`-javaagent:`) and run as the main method (`io.opentelemetry.contrib.staticinstrumenter.agent.main.Main` class).
The `opentelemetry-static-agent.jar` agent needs to be both attached (`-javaagent:`) and run as the
main method (`io.opentelemetry.contrib.staticinstrumenter.agent.main.Main` class).
The generated jar will keep the name of your non-instrumented jar.
@ -24,9 +28,37 @@ Execute the following command line:
`<file-separator>` is `:` on UNIX systems and `;` on Windows systems.
### Maven3 plugin
### Maven 3 plugin
Maven3 plugin running the static instrumentation agent during the `package` phase. Packaged archive contains statically instrumened class code.
Maven 3 plugin running the static instrumentation agent during the `package` phase. Packaged archive
contains statically instrumented class code.
| Parameter | Description |
|---------------|------------------------------------------------------------------------------------------------------------|
| artifactName | Name of the artifact to instrument. If not provided, the plugin will instrument all the project artifacts. |
| outputFolder | Path to the folder where the plugin will generate the instrumented artifacts. |
| suffix | Suffix added to the generated artifact. The default value is `-instrumented`. |
```xml
<plugin>
<groupId>io.opentelemetry.contrib</groupId>
<artifactId>static-instrumentation-maven-plugin</artifactId>
<version>...</version>
<configuration>
<artifactName>...</artifactName>
<outputFolder>...</outputFolder>
<suffix>...</suffix>
</configuration>
<executions>
<execution>
<goals>
<goal>instrument</goal>
</goals>
</execution>
</executions>
</plugin>
```
## Component owners