Skip to content

feat(otel): optional OpenTelemetry tracing (ADR-0025)#2

Merged
muhammetsafak merged 1 commit into
mainfrom
feat/otel
Jun 19, 2026
Merged

feat(otel): optional OpenTelemetry tracing (ADR-0025)#2
muhammetsafak merged 1 commit into
mainfrom
feat/otel

Conversation

@muhammetsafak

Copy link
Copy Markdown
Member

The Java mirror of babelqueue-go/otel / babelqueue.otel / @babelqueue/core/otel (ADR-0025): optional OpenTelemetry tracing in a new com.babelqueue.otel package, with io.opentelemetry:opentelemetry-api declared <optional>true</optional> — so the core stays zero-dependency at runtime for users who don't opt in.

What

  • Tracing.traceIdOf / uuidOftrace_id (a UUID) ↔ 32-hex OTel trace id (otherwise SHA-256). The already-propagated trace_id becomes the shared OTel trace across every hop/SDK — no envelope change (GR-1).
  • Tracing.wrapHandler(tracer, handler) — a CONSUMER span process <urn> in the trace_id-derived trace, with messaging-semconv attributes + recordException/ERROR status. Reuses the shared Handler, so it composes with Idempotent.wrap / SchemaValidation.wrap.
  • Tracing.publish(tracer, urn, data[, queue], send) — a PRODUCER span publish <urn> that stamps the active trace's id into the envelope's trace_id and writes it via a Sender.

Gate

mvn -B --no-transfer-progress verify: 59 tests pass (TracingTest: 5), JaCoCo bundle line coverage 96.8% (com.babelqueue.otel 92.9%) — ≥0.90 met, SpotBugs 0. Tests use opentelemetry-sdk-testing's InMemorySpanExporter.

Honest limit

One correlated trace per trace_id; exact cross-hop span parent-child (W3C traceparent as a transport header) is the documented follow-up.

🤖 Generated with Claude Code

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.
@muhammetsafak muhammetsafak merged commit 85f98a8 into main Jun 19, 2026
7 checks passed
@muhammetsafak muhammetsafak deleted the feat/otel branch June 19, 2026 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant