feat(otel): optional OpenTelemetry tracing (ADR-0025)#2
Merged
Conversation
Mirrors the Go/Python/Node reference: a new com.babelqueue.otel package emitting produce/consume spans correlated across hops via trace_id<->32-hex OTel TraceId. Tracing.wrapHandler (consumer span) + Tracing.publish (producer span over a Sender). opentelemetry-api is declared optional, so the core stays zero-dependency at runtime for users who do not opt in. Envelope untouched (GR-1); opt-in.
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.
The Java mirror of
babelqueue-go/otel/babelqueue.otel/@babelqueue/core/otel(ADR-0025): optional OpenTelemetry tracing in a newcom.babelqueue.otelpackage, withio.opentelemetry:opentelemetry-apideclared<optional>true</optional>— so the core stays zero-dependency at runtime for users who don't opt in.What
Tracing.traceIdOf/uuidOf—trace_id(a UUID) ↔ 32-hex OTel trace id (otherwise SHA-256). The already-propagatedtrace_idbecomes the shared OTel trace across every hop/SDK — no envelope change (GR-1).Tracing.wrapHandler(tracer, handler)— aCONSUMERspanprocess <urn>in thetrace_id-derived trace, with messaging-semconv attributes +recordException/ERRORstatus. Reuses the sharedHandler, so it composes withIdempotent.wrap/SchemaValidation.wrap.Tracing.publish(tracer, urn, data[, queue], send)— aPRODUCERspanpublish <urn>that stamps the active trace's id into the envelope'strace_idand writes it via aSender.Gate
mvn -B --no-transfer-progress verify: 59 tests pass (TracingTest: 5), JaCoCo bundle line coverage 96.8% (com.babelqueue.otel92.9%) — ≥0.90 met, SpotBugs 0. Tests useopentelemetry-sdk-testing'sInMemorySpanExporter.Honest limit
One correlated trace per
trace_id; exact cross-hop span parent-child (W3Ctraceparentas a transport header) is the documented follow-up.🤖 Generated with Claude Code