Repository navigation
[WO-1570] Report spans outside the invocation's trace in their own trace - #8561
Draft
jmorrell-cloudflare wants to merge 1 commit into
Draft
jmorrell-cloudflare wants to merge 1 commit into
jmorrell-cloudflare wants to merge 1 commit into
Conversation
Every tail event carries a trace ID, but the runtime always filled it with the invocation's. Spans can now belong to another trace: children of a span created elsewhere, such as in another Worker, and spans that start a new trace. Their events, and logs written inside them, carry the span's own trace ID. A span that starts a trace has no parent span ID in its spanOpen event, and is marked sampled, as OpenTelemetry's default sampler does for a root span. No new tail event fields are added. Nothing creates these spans yet; tracing.withActiveSpanContext() will. Embedders must now implement SpanSubmitter::submitSpanTrace() and makeRootTraceId(), and BaseTracer::setSpanTrace(), to carry each span's trace.
jmorrell-cloudflare
force-pushed
the
jmorrell/span-trace-context
branch
from
November 18, 2026 01:17
aebe418 to
eb4a1ef
Compare
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.
Streaming tail events now report each span in the trace it belongs to. Until now every event carried the invocation's trace ID, which is wrong for a span whose parent was created somewhere else, such as in another Worker, or for a span that starts a new trace.
A child of a span from elsewhere is reported in that span's trace. A span that starts a new trace gets a new trace ID, has no parent span ID in its
spanOpen, and is marked sampled, as OpenTelemetry's default sampler does for a root span. Logs and other events inside these spans carry the span's trace ID too. The tail event format doesn't change.Nothing creates these spans yet;
tracing.withActiveSpanContext()in the next PR will. Embedders now have to implementSpanSubmitter::submitSpanTrace()andmakeRootTraceId(), andBaseTracer::setSpanTrace(), so each span's trace reaches the tail stream.Heads up: once something creates these spans, tail workers will see
spanOpenevents with no parent and events in traces other than the invocation's. The internal build needs the matchingjmorrell/span-trace-contextedgeworker branch.