Skip to content

feat(cloudflare)!: Replace enableRpcTracePropagation with rpcTracePropagationTargets - #23486

Draft
JPeer264 wants to merge 2 commits into
developfrom
jp/rpc-trace-propagation-targets
Draft

feat(cloudflare)!: Replace enableRpcTracePropagation with rpcTracePropagationTargets#23486
JPeer264 wants to merge 2 commits into
developfrom
jp/rpc-trace-propagation-targets

Conversation

@JPeer264

Copy link
Copy Markdown
Member

closes #23233

This PR existed because of this comment: #23363 (comment)

We already have an option tracePropagationTargets and they are set to a safe default list in the browser (because in the browser we can't enable it for all addresses by default). To keep it consistent rpcTracePropagationTargets is the equivalent for RPC calls, while this has the same concerns as the browser - we can't target all RPC calls OOTB, as this would lead to issues as seen in #23233

We now remove the enableRpcTracePropagation: boolean entirely with a allow list rpcTracePropagationTargets option, that is empty by default and is therefore the equivalent of enableRpcTracePropagation: false (in a later PR we have a prefilled allowlist, like in the browser, when users do have our Vite plugin enabled).

rpcTracePropagationTargets only has to be enabled on the sender worker. The receiving worker does not have to do anything, as we automatically detect if there is a payload from us included. If there is, we strip it - it should be safe enough to listen to this by default, as we already have the last RPC parameter properly prefixed.

(when this is being backported to v10, we keep enableRpcTracePropagation: boolean, deprecate it and overrule enableRpcTracePropagation when rpcTracePropagationTargets is set (so the allow list is stronger than enabling it for everything - the receiving worker won't change for the backport)


Clanker description:

enableRpcTracePropagation: true propagated trace context to every Durable Object namespace and service binding on env. RPC carries that context as a trailing argument, and only a Sentry-instrumented receiver strips it again, so any receiver the user does not own saw an extra argument.

rpcTracePropagationTargets names the bindings to propagate to instead, mirroring tracePropagationTargets. Strings match a binding name exactly, regular expressions match by pattern.

The option is now caller-only. Receivers no longer take a switch: a Durable Object instruments its RPC methods unconditionally, matching what a WorkerEntrypoint already did. extractRpcMeta only strips a trailing argument that actually carries __sentry_rpc_meta__, so a call arriving without metadata is untouched.

…pagationTargets

`enableRpcTracePropagation: true` propagated trace context to every Durable Object
namespace and service binding on `env`. RPC carries that context as a trailing
argument, and only a Sentry-instrumented receiver strips it again, so any receiver
the user does not own saw an extra argument.

`rpcTracePropagationTargets` names the bindings to propagate to instead, mirroring
`tracePropagationTargets`. Strings match a binding name exactly, regular expressions
match by pattern.

The option is now caller-only. Receivers no longer take a switch: a Durable Object
instruments its RPC methods unconditionally, matching what a WorkerEntrypoint already
did. `extractRpcMeta` only strips a trailing argument that actually carries
`__sentry_rpc_meta__`, so a call arriving without metadata is untouched.

BREAKING CHANGE: `enableRpcTracePropagation` is removed. Replace it on the caller with
`rpcTracePropagationTargets` listing the bindings you call, and drop it from receivers.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 30.3 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.58 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.59 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.46 kB - -
@sentry/browser (incl. Tracing, Replay) 87.98 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.36 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 92.7 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 105.39 kB - -
@sentry/browser (incl. Feedback) 47.65 kB - -
@sentry/browser (incl. sendFeedback) 35.13 kB - -
@sentry/browser (incl. FeedbackAsync) 40.28 kB - -
@sentry/browser (incl. Metrics) 31.24 kB - -
@sentry/browser (incl. Logs) 31.52 kB - -
@sentry/browser (incl. Metrics & Logs) 32.15 kB - -
@sentry/react 32.09 kB - -
@sentry/react (incl. Tracing) 50.77 kB - -
@sentry/vue 35.34 kB - -
@sentry/vue (incl. Tracing) 50.54 kB - -
@sentry/svelte 30.33 kB - -
CDN Bundle 31.61 kB - -
CDN Bundle (incl. Tracing) 48.9 kB - -
CDN Bundle (incl. Logs, Metrics) 33.8 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 50.82 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.31 kB - -
CDN Bundle (incl. Tracing, Replay) 86.48 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.31 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.19 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.12 kB - -
CDN Bundle - uncompressed 93.84 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.75 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.14 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.44 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.08 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.01 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.68 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.71 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.37 kB - -
@sentry/nextjs (client) 53.29 kB - -
@sentry/sveltekit (client) 49 kB - -
@sentry/core/server 65.38 kB - -
@sentry/core/browser 51.72 kB - -
@sentry/node 117.4 kB +0.02% +22 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.08 kB - -
@sentry/node - without tracing 81.91 kB +0.03% +23 B 🔺
@sentry/aws-serverless 91.32 kB +0.03% +24 B 🔺
@sentry/cloudflare (withSentry) - minified 214.07 kB +0.05% +89 B 🔺
@sentry/cloudflare (withSentry) 529.33 kB +0.08% +399 B 🔺

View base workflow run

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.

Cloudflare RPC trace propagation changes method arguments for uninstrumented receivers

1 participant