Skip to content

feat(cloudflare): Derive rpcTracePropagationBindings from the wrangler config - #23491

Merged
JPeer264 merged 3 commits into
jp/rpc-trace-propagation-targetsfrom
jp/rpc-trace-propagation-targets-vite
Aug 28, 2026
Merged

feat(cloudflare): Derive rpcTracePropagationBindings from the wrangler config#23491
JPeer264 merged 3 commits into
jp/rpc-trace-propagation-targetsfrom
jp/rpc-trace-propagation-targets-vite

Conversation

@JPeer264

@JPeer264 JPeer264 commented Aug 23, 2026

Copy link
Copy Markdown
Member

The Vite plugin already knows which bindings resolve to receivers it instruments itself: Durable Object bindings without a script_name, and service bindings naming this worker. Those are exactly the bindings whose trailing trace argument is guaranteed to be stripped again, so the plugin adds them to rpcTracePropagationBindings and same-deployment RPC traces connect without any configuration. Bindings to other workers stay opt-in.

Only bindings whose receiver class the transform wrapped itself are added. A class the user wrapped by hand, or re-exported from another module, runs on its own options and cannot be assumed to strip the argument.

The options object only exists once the callback runs with env, so the plugin cannot merge at build time. The transform emits an inline callback that wraps the user's one and merges the binding names, so no runtime helper export is needed.

Note this default only applies to Vite builds. At runtime a DurableObjectNamespace exposes no origin and a Fetcher does not say which service it points at, so a plain wrangler build still has to list its bindings.

@JPeer264 JPeer264 self-assigned this Aug 23, 2026
@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 28.56 kB - -
@sentry/browser - with treeshaking flags 26.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.82 kB - -
@sentry/browser (incl. Tracing) 48.63 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.64 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.55 kB - -
@sentry/browser (incl. Tracing, Replay) 88.09 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.52 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 92.79 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 105.73 kB - -
@sentry/browser (incl. Feedback) 46.05 kB - -
@sentry/browser (incl. sendFeedback) 33.62 kB - -
@sentry/browser (incl. FeedbackAsync) 38.73 kB - -
@sentry/browser (incl. Metrics) 29.51 kB - -
@sentry/browser (incl. Logs) 29.8 kB - -
@sentry/browser (incl. Metrics & Logs) 30.43 kB - -
@sentry/react 30.3 kB - -
@sentry/react (incl. Tracing) 50.83 kB - -
@sentry/vue 35.69 kB - -
@sentry/vue (incl. Tracing) 50.86 kB - -
@sentry/svelte 28.59 kB - -
CDN Bundle 30.35 kB - -
CDN Bundle (incl. Tracing) 49.23 kB - -
CDN Bundle (incl. Logs, Metrics) 32.58 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 51.12 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.17 kB - -
CDN Bundle (incl. Tracing, Replay) 86.72 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.6 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.62 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.5 kB - -
CDN Bundle - uncompressed 89.95 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.82 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.24 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.51 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.41 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.32 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 272 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 280.02 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.69 kB - -
@sentry/nextjs (client) 53.41 kB - -
@sentry/sveltekit (client) 49.07 kB - -
@sentry/core/server 65.15 kB - -
@sentry/core/browser 51.8 kB - -
@sentry/node 122.74 kB +0.02% +17 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.23 kB - -
@sentry/node - without tracing 87.74 kB +0.03% +25 B 🔺
@sentry/node - without channel injection 102.4 kB +0.02% +17 B 🔺
@sentry/aws-serverless 95.9 kB +0.03% +25 B 🔺
@sentry/cloudflare (withSentry) - minified 199.71 kB +0.02% +24 B 🔺
@sentry/cloudflare (withSentry) 496.56 kB +0.08% +368 B 🔺

View base workflow run

@JPeer264

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a85e9fb. Configure here.

Comment thread packages/cloudflare/src/vite/transform.ts
@JPeer264
JPeer264 force-pushed the jp/rpc-trace-propagation-targets-vite branch 2 times, most recently from 562ceae to ceb803d Compare August 25, 2026 11:54
@JPeer264
JPeer264 force-pushed the jp/rpc-trace-propagation-targets-vite branch from ceb803d to 16c724f Compare August 25, 2026 11:56
@JPeer264
JPeer264 force-pushed the jp/rpc-trace-propagation-targets-vite branch from c5b4c26 to 5e5b6a8 Compare August 26, 2026 07:41
@JPeer264
JPeer264 force-pushed the jp/rpc-trace-propagation-targets-vite branch 2 times, most recently from 29752e8 to 6a991fa Compare August 26, 2026 10:53
@JPeer264
JPeer264 marked this pull request as ready for review August 26, 2026 11:33
@JPeer264
JPeer264 requested a review from a team as a code owner August 26, 2026 11:33
@JPeer264
JPeer264 requested review from andreiborza and isaacs and removed request for a team August 26, 2026 11:33
@JPeer264
JPeer264 marked this pull request as draft August 26, 2026 11:34
@JPeer264
JPeer264 force-pushed the jp/rpc-trace-propagation-targets-vite branch from 6a991fa to 4e616df Compare August 26, 2026 11:41
@JPeer264
JPeer264 marked this pull request as ready for review August 26, 2026 11:55
@JPeer264
JPeer264 requested review from andreiborza and isaacs August 26, 2026 11:55
@JPeer264 JPeer264 changed the title feat(cloudflare): Derive rpcTracePropagationTargets from the wrangler config feat(cloudflare): Derive rpcTracePropagationBindings from the wrangler config Aug 26, 2026
Comment thread packages/cloudflare/src/vite/transform.ts Outdated
JPeer264 and others added 2 commits August 28, 2026 13:59
…r config

The Vite plugin already knows which bindings resolve to receivers it instruments
itself: Durable Object bindings without a `script_name`, and service bindings
naming this worker. Those are exactly the bindings whose trailing trace argument is
guaranteed to be stripped again, so the plugin adds them to
`rpcTracePropagationBindings` and same-deployment RPC traces connect without any
configuration. Bindings to other workers stay opt-in.

Only bindings whose receiver class the transform wrapped itself are added. A class
the user wrapped by hand, or re-exported from another module, runs on its own
options and cannot be assumed to strip the argument.

The options object only exists once the callback runs with `env`, so the plugin
cannot merge at build time. The transform emits an inline callback that wraps the
user's one and merges the binding names, so no runtime helper export is needed.

Note this default only applies to Vite builds. At runtime a DurableObjectNamespace
exposes no origin and a Fetcher does not say which service it points at, so a plain
wrangler build still has to list its bindings.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…as auto-wrapped

`export default Foo`, where a named export already wrapped `Foo`, skips wrapping
to avoid `withSentry(withSentry(...))`, but the binding still points at the
wrapped class. Mark the default export as auto-wrapped so an entrypoint-less
self service binding survives into `rpcTracePropagationBindings`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@JPeer264
JPeer264 force-pushed the jp/rpc-trace-propagation-targets-vite branch from 3c8302d to 0598681 Compare August 28, 2026 11:59
@JPeer264
JPeer264 merged commit 0305e9e into develop Aug 28, 2026
88 of 117 checks passed
@JPeer264
JPeer264 deleted the jp/rpc-trace-propagation-targets-vite branch August 28, 2026 12:44
JPeer264 added a commit that referenced this pull request Aug 28, 2026
…ngler config (#23738)

Backport of: #23491

## Differences to the original PR

- `packages/cloudflare/src/vite/transform.ts`: the generated options
callback also sets `enableRpcTracePropagation:
opts?.enableRpcTracePropagation ?? true`. On v10 the receiver still
reads that option to continue an incoming trace, and the plugin wrapped
those receiver classes itself, so it can turn it on. An explicit value
in the user's options wins. Without it the derived bindings would
propagate but no receiver span would be created.
- `packages/cloudflare/src/vite/index.ts` and the new integration
suite's `vite.config.mts`: `autoInstrumentation` lives under
`_experimental` on v10, so the doc paragraph and the test config use
that shape.
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.

2 participants