Skip to content

feat(react-router): Emit low-cardinality names for function spans - #24567

Merged
Lms24 merged 1 commit into
developfrom
fix/react-router-function-span-names
Sep 22, 2026
Merged

Lms24 merged 1 commit into
developfrom
fix/react-router-function-span-names

Conversation

@Lms24

@Lms24 Lms24 commented Sep 21, 2026

Copy link
Copy Markdown
Member

The loader, action and fetcher spans started by the instrumentation API named themselves after whatever value was at hand: the route pattern, which falls back to the raw request path whenever React Router matches no pattern, or the fetcher key, which is unique per fetcher instance. Under span streaming both are high cardinality. They now use the function they wrap: the code.function.name these spans already set, so the name matches what the function op's convention asks for.

The previous name is kept on sentry.description instead, to override span description inference in Relay that doesn't apply to the previous naming pattern.

ref #23954

The loader, action and fetcher spans from the instrumentation API still
named themselves after the value they had at hand: the route pattern,
which falls back to the raw request path when React Router matches no
pattern, or the fetcher key, which is unique per fetcher instance. Under
span streaming both are high cardinality.

Name these spans after the function they wrap, matching the
`code.function.name` they already set. The `function` op's description
template is `{{code.function.name}}` and nothing else, so Relay cannot
infer the route from any attribute we could add - the previous name is
kept on `sentry.description` instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.07 kB - -
@sentry/browser - with treeshaking flags 27.34 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.24 kB - -
@sentry/browser (incl. Tracing) 50.56 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 50.58 kB - -
@sentry/browser (incl. Tracing, Profiling) 53.58 kB - -
@sentry/browser (incl. Tracing, Replay) 90.11 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.2 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 94.82 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 107.79 kB - -
@sentry/browser (incl. Feedback) 46.6 kB - -
@sentry/browser (incl. sendFeedback) 34.13 kB - -
@sentry/browser (incl. FeedbackAsync) 39.25 kB - -
@sentry/browser (incl. Metrics) 30.08 kB - -
@sentry/browser (incl. Logs) 30.34 kB - -
@sentry/browser (incl. Metrics & Logs) 31 kB - -
@sentry/react 30.82 kB - -
@sentry/react (incl. Tracing) 52.89 kB - -
@sentry/vue 36.33 kB - -
@sentry/vue (incl. Tracing) 52.87 kB - -
@sentry/svelte 29.1 kB - -
CDN Bundle 30.77 kB - -
CDN Bundle (incl. Tracing) 51.09 kB - -
CDN Bundle (incl. Logs, Metrics) 33.02 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.07 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.71 kB - -
CDN Bundle (incl. Tracing, Replay) 88.63 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 90.56 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 94.67 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 96.7 kB - -
CDN Bundle - uncompressed 91.07 kB - -
CDN Bundle (incl. Tracing) - uncompressed 152.52 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.64 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 158.48 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 227.05 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 272.09 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 278.03 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 285.8 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 291.73 kB - -
@sentry/nextjs (client) 55.22 kB - -
@sentry/sveltekit (client) 51.01 kB - -
@sentry/core/server 39.97 kB - -
@sentry/core/browser 13.63 kB - -
@sentry/node 133.37 kB +0.02% +19 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.15 kB - -
@sentry/node - without tracing 89.92 kB +0.03% +20 B 🔺
@sentry/node - without channel injection 112.16 kB +0.02% +22 B 🔺
@sentry/aws-serverless 98.19 kB +0.02% +18 B 🔺
@sentry/cloudflare (withSentry) - minified 204.67 kB - -
@sentry/cloudflare (withSentry) 509.34 kB - -

View base workflow run

@Lms24 Lms24 changed the title fix(react-router): Use low-cardinality names for function spans fix(react-router): Emit low-cardinality names for function spans Sep 22, 2026
@Lms24
Lms24 marked this pull request as ready for review September 22, 2026 11:14
@Lms24
Lms24 requested a review from a team as a code owner September 22, 2026 11:14
@Lms24
Lms24 requested review from nicohrubec and s1gr1d and removed request for a team September 22, 2026 11:14
@Lms24 Lms24 changed the title fix(react-router): Emit low-cardinality names for function spans feat(react-router): Emit low-cardinality names for function spans Sep 22, 2026
@Lms24
Lms24 merged commit bcec99a into develop Sep 22, 2026
52 checks passed
@Lms24
Lms24 deleted the fix/react-router-function-span-names branch September 22, 2026 14:38
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