feat(otel): optional OpenTelemetry tracing (ADR-0025)#2
Merged
Conversation
…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.
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 Node mirror of
babelqueue-go/otel/babelqueue.otel(ADR-0025): optional OpenTelemetry tracing exposed via the@babelqueue/core/otelsubpath, with@opentelemetry/apias an optional peer dependency — so importing@babelqueue/coreitself stays dependency-free (GR-7).What
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).wrapHandler(tracer, handler)— a CONSUMER spanprocess <urn>in thetrace_id-derived trace, with messaging-semconv attributes + error recording. The handler receives the fullEnvelopeas before.publish(tracer, urn, data, send)— a PRODUCER spanpublish <urn>that builds the envelope with the active trace's id astrace_idand runs the user'ssend(transport write) within the span.Tests / CI
otel.tsat 100% lines/functions; typecheck + eslint clean; the existing c8 gate (lines/functions ≥90, branches ≥85) stays green (89% branches overall).tsupbuilds the./otelentry (dual ESM+CJS + types).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