Skip to content

ref(cloudflare)!: Use shared SentryTracerProvider for OpenTelemetry interop - #23300

Draft
JPeer264 wants to merge 3 commits into
developfrom
jp/cloudflare-tracerprovider
Draft

ref(cloudflare)!: Use shared SentryTracerProvider for OpenTelemetry interop#23300
JPeer264 wants to merge 3 commits into
developfrom
jp/cloudflare-tracerprovider

Conversation

@JPeer264

@JPeer264 JPeer264 commented Aug 11, 2026

Copy link
Copy Markdown
Member

This uses now the SentryTracerProvider and removes the previous kinda mocked provider. I added two integration tests that check if OTel traces are picked up by our provider—just to tripple check if the machinery is implemented correctly.

I made it breaking since the sentry.cloudflare_tracer attribute is being removed now (I added this as a fixup in the migration guide)

Also for Hydrogen aka the /request entrypoint, we no longer support the enableOpenTelemetrySetup option, as this would require node:async_hooks, which isn't available in Hydrogen. In case this would be needed in the future we can enable this and readd the previous OTel Tracer Provider. But for now it is better to keep it simple.


Clanker machinery comment:

Replaces the bespoke Cloudflare tracer with SentryTracerProvider from @sentry/opentelemetry, and covers enableOpenTelemetrySetup end to end in workerd with two integration suites.

The enabled suite documents that startActiveSpan detaches into a root transaction of its own rather than nesting under the request span: it always resolves an explicit context, and Cloudflare installs no OTel context manager, so context.active() never carries the request span. startSpan passes no context and does nest, so both paths are asserted to pin the difference.

The two workers are kept identical apart from the option itself, so the disabled suite also proves the wider OTel surface stays inert when the provider is off.

JPeer264 and others added 2 commits August 11, 2026 16:29
… interop

Replaces the bespoke Cloudflare tracer with `SentryTracerProvider` from
`@sentry/opentelemetry`, and covers `enableOpenTelemetrySetup` end to end in
workerd with two integration suites.

The enabled suite documents that `startActiveSpan` detaches into a root
transaction of its own rather than nesting under the request span: it always
resolves an explicit context, and Cloudflare installs no OTel context manager,
so `context.active()` never carries the request span. `startSpan` passes no
context and does nest, so both paths are asserted to pin the difference.

The two workers are kept identical apart from the option itself, so the disabled
suite also proves the wider OTel surface stays inert when the provider is off.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@JPeer264 JPeer264 self-assigned this Aug 11, 2026
@JPeer264
JPeer264 requested a review from a team as a code owner August 11, 2026 14:34
@JPeer264
JPeer264 requested review from andreiborza, isaacs, mydea and s1gr1d and removed request for a team, isaacs and mydea August 11, 2026 14:34
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 30.29 kB - -
@sentry/browser - with treeshaking flags 28.47 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.81 kB - -
@sentry/browser (incl. Tracing) 48.53 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.55 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.43 kB - -
@sentry/browser (incl. Tracing, Replay) 87.92 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.34 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 92.64 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 105.34 kB - -
@sentry/browser (incl. Feedback) 47.62 kB - -
@sentry/browser (incl. sendFeedback) 35.12 kB - -
@sentry/browser (incl. FeedbackAsync) 40.27 kB - -
@sentry/browser (incl. Metrics) 31.28 kB - -
@sentry/browser (incl. Logs) 31.54 kB - -
@sentry/browser (incl. Metrics & Logs) 32.21 kB - -
@sentry/react 32.09 kB - -
@sentry/react (incl. Tracing) 50.72 kB - -
@sentry/vue 35.3 kB - -
@sentry/vue (incl. Tracing) 50.48 kB - -
@sentry/svelte 30.31 kB - -
CDN Bundle 31.6 kB - -
CDN Bundle (incl. Tracing) 48.85 kB - -
CDN Bundle (incl. Logs, Metrics) 33.82 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 50.81 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.35 kB - -
CDN Bundle (incl. Tracing, Replay) 86.44 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.31 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.15 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.13 kB - -
CDN Bundle - uncompressed 93.83 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.66 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.23 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.45 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.17 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.92 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.7 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.62 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.39 kB - -
@sentry/nextjs (client) 53.27 kB - -
@sentry/sveltekit (client) 48.94 kB - -
@sentry/core/server 65.41 kB - -
@sentry/core/browser 51.77 kB - -
@sentry/node 117.95 kB - -
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 82.06 kB - -
@sentry/aws-serverless 91.45 kB - -
@sentry/cloudflare (withSentry) - minified 216.1 kB +1.04% +2.22 kB 🔺
@sentry/cloudflare (withSentry) 534.06 kB +1.1% +5.76 kB 🔺

View base workflow run

@JPeer264
JPeer264 marked this pull request as draft August 12, 2026 08:09
@JPeer264
JPeer264 force-pushed the jp/cloudflare-tracerprovider branch 2 times, most recently from 28f82ba to 2f6a005 Compare August 12, 2026 08:46
@JPeer264
JPeer264 force-pushed the jp/cloudflare-tracerprovider branch from 2f6a005 to 03da001 Compare August 12, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant