Maven extension to observe Maven builds as distributed traces.
Migration
To migrate please replace "co.elastic.opentelemetry.contrib:opentelemetry-maven-extension:0.1.0-beta-5" by "io.opentelemetry.contrib:opentelemetry-maven-extension:1.7.0-alpha":
<project>
...
<build>
<extensions>
<!-- DEPRECATED -->
<extension>
<groupId>co.elastic.opentelemetry.contrib</groupId>
<artifactId>opentelemetry-maven-extension</artifactId>
<version>0.1.0-beta-5</version>
</extension>
<!-- NEW ARTIFACT -->
<extension>
<groupId>io.opentelemetry.contrib</groupId>
<artifactId>opentelemetry-maven-extension</artifactId>
<version>1.7.0-alpha</version>
</extension>
</extensions>
</build>
</project>
The Maven OpenTelemetry Extension is configured using environment variables or JVM system properties and it can be added to a build using one of the following ways:
- adding the extension jar to
${maven.home}/lib/ext
- adding the path to the extension jar to
-Dmaven.ext.class.path
, - adding the extension as a build extension in the
pom.xml
, - (since Maven 3.3.1) configuring the extension in
.mvn/extensions.xml
.
Add the Maven OpenTelemetry Extension to ${maven.home}/lib/ext
or to the classpath using -Dmaven.ext.class.path=
.
mvn dependency:copy \
-Dartifact=co.elastic.opentelemetry.contrib:opentelemetry-maven-extension:0.1.0-beta-5 \
-DoutputAbsoluteArtifactFilename=opentelemetry-maven-extension.jar
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
mvn -Dmaven.ext.class.path=target/dependency/opentelemetry-maven-extension.jar verify
Add the Maven OpenTelemetry Extension in the pom.xml
file:
<project>
...
<build>
<extensions>
<extension>
<groupId>co.elastic.opentelemetry.contrib</groupId>
<artifactId>opentelemetry-maven-extension</artifactId>
<version>0.1.0-beta-5</version>
</extension>
</extensions>
</build>
</project>
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
mvn verify
The Maven OpenTelemetry Extension supports a subset of the OpenTelemetry auto configuration environment variables and JVM system properties.
System property | Environment variable | Description |
---|---|---|
otel.exporter.otlp.endpoint | OTEL_EXPORTER_OTLP_ENDPOINT | The OTLP traces and metrics endpoint to connect to. Must be a URL with a scheme of either http or https based on the use of TLS. Example http://localhost:4317 . |
otel.exporter.otlp.headers | OTEL_EXPORTER_OTLP_HEADERS | Key-value pairs separated by commas to pass as request headers on OTLP trace and metrics requests. |
otel.exporter.otlp.timeout | OTEL_EXPORTER_OTLP_TIMEOUT | The maximum waiting time, in milliseconds, allowed to send each OTLP trace and metric batch. Default is 10000 . |
otel.resource.attributes | OTEL_RESOURCE_ATTRIBUTES | Specify resource attributes in the following format: key1=val1,key2=val2,key3=val3 |
ℹ️ The service.name
is set by default to maven
, it can be overwritten specifying resource atributes.
Distributed trace combining the OpenTelemetry Maven Extension with the Jenkins OpenTelemetry plugin.
Trace visualized with Elastic Observability
Trace visualized with Jaeger Tracing
List of other CI/CD tools that support OpenTelemetry traces and integrate with the Maven OpenTelemetry Extension creating a distributed traces providing end to end visibility.
The Jenkins OpenTelemetry Plugin exposes Jenkins pipelines & jobs as OpenTelemetry traces and exposes Jenkins health indicators as OpenTelemetry metrics.
The otel-cli
is a command line wrapper to observe the execution of a shell command as an OpenTelemetry trace.