Repository navigation
Add trace correlation IDs to build reports - #13627
Merged
gnodet merged 1 commit intoOct 22, 2026
Merged
Conversation
Expose optional trace and span identifiers for module and mojo reports. Capture tracing context from the SLF4J MDC at lifecycle start events and include it in JSON build reports. Bump the additive report schema version and cover both populated and absent correlation fields in tests.
gnodet-bot
approved these changes
Oct 19, 2026
gnodet-bot
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Trace correlation IDs are correctly captured from the SLF4J MDC at event-start time, properly null-guarded with nonBlank() and TraceContext.EMPTY, and consistently propagated through all assembly paths — including the mojo stream in buildModuleReport and the module-level path. API design follows the noun-style accessor convention (traceId(), spanId()) required for @Immutable interfaces. Tests cover both the populated and null cases; the @AfterEach MDC cleanup is correct. No issues found.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
gnodet
pushed a commit
to gnodet/maven
that referenced
this pull request
Oct 24, 2026
Expose optional trace and span identifiers for module and mojo reports. Capture tracing context from the SLF4J MDC at lifecycle start events and include it in JSON build reports. Bump the additive report schema version and cover both populated and absent correlation fields in tests.
gnodet
pushed a commit
to gnodet/maven
that referenced
this pull request
Oct 25, 2026
Expose optional trace and span identifiers for module and mojo reports. Capture tracing context from the SLF4J MDC at lifecycle start events and include it in JSON build reports. Bump the additive report schema version and cover both populated and absent correlation fields in tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses #13567 by adding optional OpenTelemetry trace and span correlation identifiers to module and mojo entries in Maven build reports.
Issue: #13567
This PR is intentionally based on and targets
feature/build-report, because the BuildReport API is introduced by #12695.How it works:
I added nullable
traceId()andspanId()fields toModuleReportandMojoReport.BuildReportCollectorsnapshots theotel.trace_idandotel.span_idvalues from the SLF4J MDC when a project or mojo starts, preserves them for the corresponding report entry, and leaves them null when no tracing extension provides a context. Skipped mojos also leave these fields null because no mojo span is started for them.The JSON writer now emits the two optional fields for modules and mojos. Since this is an additive schema change, the report version is updated from
1.0to1.1.Why this is necessary:
Build reports currently describe Maven module and mojo execution, while tracing extensions record the same work as OpenTelemetry spans. Without correlation IDs, users cannot reliably move from a failed or slow build-report entry to the corresponding trace and span in their observability backend. Defining an MDC-based handoff lets tracing extensions supply this context without adding a direct OpenTelemetry dependency to Maven Core.
Testing:
1.1.mvn -o -pl impl/maven-core -am -DskipITs -Drat.skip=true -Dtest=BuildReportCollectorTest,BuildReportJsonWriterTest -Dsurefire.failIfNoSpecifiedTests=false testChecklist
mvn verifyto make sure basic checks pass.To make clear that you license your contribution under the Apache License Version 2.0, January 2004, you have to acknowledge this by using the following checkbox.