Package com.babelqueue.otel


package com.babelqueue.otel
Optional OpenTelemetry tracing for babelqueue (ADR-0025 v0.1 + ADR-0028 v0.2) — the Java mirror of the Go babelqueue-go/otel, Python babelqueue.otel and Node @babelqueue/core/otel modules.

Tracing emits a CONSUMER span per handled message and a PRODUCER span per publish, propagating the trace across every hop and SDK at two layered levels:

  • trace_id ↔ OTel trace id (v0.1): the envelope's trace_id — a UUID — maps 1:1 to a 32-hex OpenTelemetry trace id, so every hop that shares a trace_id shares one OTel trace (correlation + per-hop timing) with zero wire/transport change.
  • W3C traceparent transport header (v0.2): the producer also injects the active span context as a traceparent onto an out-of-band header map that rides beside the frozen envelope (HeaderSender); the consumer reads it and starts its span as a true child of the producer span (a delivered-headers Supplier on wrapHandler). With no traceparent present it falls back to the v0.1 trace_id parent — a strict, backward-compatible upgrade.

The wire envelope is untouched (GR-1, schema_version stays 1), and io.opentelemetry:opentelemetry-api (which itself ships OTel's W3C propagator) is declared as an optional dependency, so the core stays zero-dependency for users who do not opt in (GR-7).

This module delivers the v0.2 mechanism. The Java transports live in separate artifacts (babelqueue-java-sqs, babelqueue-java-redis, babelqueue-spring), so carrying the out-of-band header map on each broker's native per-message metadata channel is a documented per-transport follow-up.