feat(otel): optional OpenTelemetry (ActivitySource) tracing (ADR-0025)#2
Merged
Conversation
Mirrors the Go/Python/Node otel modules: a BabelQueue.Tracing.Telemetry helper emitting produce/consume Activities correlated across hops via trace_id<->ActivityTraceId. Wrap (consumer activity) + PublishAsync (producer activity). Built on System.Diagnostics.ActivitySource (the BCL primitive the OpenTelemetry .NET SDK consumes), so the core takes no OpenTelemetry package dependency; a consumer exports by adding the "BabelQueue" source to a TracerProvider. 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 .NET mirror of the Go/Python/Node otel modules (ADR-0025): optional OpenTelemetry tracing as a
BabelQueue.Tracing.Telemetryhelper, built onSystem.Diagnostics.ActivitySource— the BCL primitive the OpenTelemetry .NET SDK consumes — so the core takes no OpenTelemetry package dependency and stays zero-dep. A consumer exports by adding the"BabelQueue"source to aTracerProvider(AddSource("BabelQueue")).What
TraceIdOf/UuidOf—trace_id(a UUID) ↔ActivityTraceId(otherwise SHA-256). The already-propagatedtrace_idbecomes the shared trace across every hop/SDK — no envelope change (GR-1).Telemetry.Wrap(handler)— a CONSUMER Activityprocess <urn>in thetrace_id-derived trace, with messaging-semconv tags + error recording. The handler still receives the fullEnvelope.Telemetry.PublishAsync(urn, data, send)— a PRODUCER Activitypublish <urn>that builds the envelope with the active trace's id astrace_idand runs the user'ssendwithin the activity.Tests / gate
ActivityListener(mapping round-trip, consumer activity + tags, partial-envelope tolerance, error recording, producer stamping, producer error).dotnet test -c Release: 41 passed, 0 failed, 0 warnings (Roslyn analyzers +TreatWarningsAsErrors).PackageReference; no<Version>bump.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