fix(ext/telemetry): otel baggage propagation#31620
Conversation
There were three bugs in baggage propagation: - `BaggageImpl` was not reading items from the map passsed in, instead always creating an empty baggage - `Deno.serve` was reading out baggage and storing it in a context, but then not starting the callback in that context, but in the parent context, meaning the user did not have access to the baggage. - The baggage was stored on the context with the wrong key. The gist of it is that `propagation.getActiveBaggage()` works now.
WalkthroughenterSpan now accepts an optional Context and callers pass an active tracing context when available. Baggage storage was refactored to use a new BAGGAGE_KEY; BaggageImpl now clones entries via SafeMap iteration. W3CBaggagePropagator inject/extract logic changed (removed empty-header early-exit). SafeIterator uses were replaced by SafeArrayIterator. A new CompositePropagator was added and bootstrap propagation wiring now considers configured propagators. Tests add server readiness files, polling-based startup waits, onListen hooks, active-baggage logging, and an HTTP request sending a baggage header Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🪛 Biome (2.1.2)ext/telemetry/telemetry.ts[error] 46-46: Do not shadow the global "decodeURIComponent" property. Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. (lint/suspicious/noShadowRestrictedNames) [error] 47-47: Do not shadow the global "encodeURIComponent" property. Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. (lint/suspicious/noShadowRestrictedNames) 🔇 Additional comments (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There were three bugs in baggage propagation:
BaggageImplwas not reading items from the map passsed in, instead always creating an empty baggageDeno.servewas reading out baggage and storing it in a context, but then not starting the callback in that context, but in the parent context, meaning the user did not have access to the baggage.The gist of it is that
propagation.getActiveBaggage()works now.Secondly, this adds a composite propagator into the global OTEL context, so that
propagation.extract()andpropagation.inject()start working.Fixes #28085 and fixes #30064, towards #28082