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 Node mirror of babelqueue-go/otel / babelqueue.otel (ADR-0025): optional OpenTelemetry tracing exposed via the @babelqueue/core/otel subpath, with @opentelemetry/api as an optional peer dependency — so importing @babelqueue/core itself stays dependency-free (GR-7).

What

  • 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).
  • wrapHandler(tracer, handler) — a CONSUMER span process <urn> in the trace_id-derived trace, with messaging-semconv attributes + error recording. The handler receives the full Envelope as before.
  • publish(tracer, urn, data, send) — a PRODUCER span publish <urn> that builds the envelope with the active trace's id as trace_id and runs the user's send (transport write) within the span.

Tests / CI

  • 6 tests via the in-memory span exporter; otel.ts at 100% lines/functions; typecheck + eslint clean; the existing c8 gate (lines/functions ≥90, branches ≥85) stays green (89% branches overall). tsup builds the ./otel entry (dual ESM+CJS + types).

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

…tel subpath (ADR-0025)

Mirrors the Go/Python reference: a new src/otel.ts (reached only via the @babelqueue/core/otel subpath, so importing the core stays dependency-free) emitting produce/consume spans correlated across hops via trace_id<->32-hex OTel TraceID. wrapHandler (consumer span) + publish (producer-span wrapper around a send callback). @opentelemetry/api is an optional peer dependency. Envelope untouched (GR-1); opt-in.
@muhammetsafak muhammetsafak merged commit 6fa6d8e into main Jun 19, 2026
11 checks passed
@muhammetsafak muhammetsafak deleted the feat/otel branch June 19, 2026 03:19
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