Repository navigation
Conversation
Contributor
size-limit report 📦Compared: dbfd19c (PR test merge using develop at 00ee6b7) Against: 00ee6b7 (develop) · base run #62916 ✅ Baseline matches: this diff contains only this PR's changes.
|
The SDK now reads `ctx.tracing.getActiveSpan().spanContext()` and sets the propagation context to the Cloudflare trace id and span id. Errors, logs and spans then use the same trace id as the spans that Cloudflare exports, also when `tracesSampleRate` is 0. An incoming `sentry-trace` header keeps precedence. Runtimes without `spanContext()` and invocations that Cloudflare does not trace keep the current behavior. `spanContext()` ships in workerd 1.20261009.1, so only the optional CI job with the latest wrangler runs the new code path. The tests pass on both wranglers. The latest wrangler traces every local invocation, so a root span can have the Cloudflare span as parent, and the tests find the child segment by its parent instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JPeer264
force-pushed
the
jp/cloudflare-native-trace-id-events
branch
from
October 21, 2026 12:36
117c409 to
0d94f79
Compare
This branch has not been deployed
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.
closes #22214
closes JS-3018
Description
This continues the trace that Cloudflare starts for each invocation (fetch, scheduled, queue and email handlers). Errors, logs and spans then have the same trace id as the Cloudflare spans in Workers Observability, also with
tracesSampleRate: 0. An incomingsentry-traceheader still has precedence.Most of the changed lines are tests.
Sampling decisions
The SDK continues only invocations that Cloudflare traces, but it does not take the Cloudflare sampling decision:
tracesSampleRatestill decides. The alternative is to pass the Cloudflare decision on assampled, so that Sentry keeps the same traces as Cloudflare.Known issues
Span.spanContext(), which ships in workerd 1.20261009.1. Older runtimes keep the current behavior, so only the optional CI job with the latest wrangler runs the new code path.Sentry traces
Sentry trace whose root span has the Cloudflare span as parent: https://sentry-sdks.sentry.io/explore/traces/trace/69d9287a44d4faddcda5b6612256e6b6/?project=4510555608449024&statsPeriod=14d