You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[maven-extension] Propagate OTel context to plugin mojos (#786)
**Description:**
Propagate OTel context to plugin mojos so they can add their own
attributes and spans to traces.
**Existing Issue(s):**
None
**Testing:**
No unit test framework compatible with JUnit 5 for Maven builds yet.
**Documentation:**
See updated README.md
**Outstanding items:**
None
@@ -175,6 +175,70 @@ The [Jenkins OpenTelemetry Plugin](https://plugins.jenkins.io/opentelemetry/) ex
175
175
176
176
The [`otel-cli`](https://github.com/equinix-labs/otel-cli) is a command line wrapper to observe the execution of a shell command as an OpenTelemetry trace.
177
177
178
+
## Instrumenting Maven Mojos for better visibility in Maven builds
179
+
180
+
Maven plugin authors can instrument Mojos for better visibility in Maven builds.
181
+
182
+
Common instrumentation patterns include:
183
+
184
+
* Adding contextual data as attributes on the spans created by the OpenTelemetry Maven Extension,
185
+
* Creating additional sub spans to breakdown long mojo goal executions in finer grained steps
186
+
187
+
Note that the instrumentation of a plugin is enabled when the OpenTelemetry Maven extension is added to the build and activated.
188
+
Otherwise, the instrumentation of the Maven plugin is noop.
189
+
190
+
It is recommended to enrich spans using the [OpenTelemetry Semantic Conventions](https://opentelemetry.io/docs/concepts/semantic-conventions/)
191
+
to improve the visualization and analysis in Observability products.
192
+
The [HTTP](https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/http/)
193
+
and [database client calls](https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/database/)
194
+
conventions are particularly useful when invoking external systems.
195
+
196
+
Steps to instrument a Maven Mojo:
197
+
198
+
* Add the OpenTelemetry API dependency in the `pom.xml` of the Maven plugin.
0 commit comments