Skip to content

fix(nextjs): Treat static route span names as low-cardinality names - #23503

Merged
Lms24 merged 2 commits into
developfrom
lms/fix-nextjs-static-route-parameterization
Aug 24, 2026
Merged

fix(nextjs): Treat static route span names as low-cardinality names#23503
Lms24 merged 2 commits into
developfrom
lms/fix-nextjs-static-route-parameterization

Conversation

@Lms24

@Lms24 Lms24 commented Aug 24, 2026

Copy link
Copy Markdown
Member

This PR fixes a "bug" in which we annotated static (paramter-less) routes as high-cardinality (source: 'url') unparamterized URL span names. While these routes do not contain a parameter, we can still guarantee that we resolved them to a static route (via the manifest route matching), so we should annotate it as low card. (source: 'route').

@github-actions

github-actions Bot commented Aug 24, 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 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.6 kB +0.04% +18 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 48.61 kB +0.05% +23 B 🔺
@sentry/browser (incl. Tracing, Profiling) 51.49 kB +0.07% +32 B 🔺
@sentry/browser (incl. Tracing, Replay) 88 kB +0.03% +22 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.4 kB +0.06% +40 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 92.72 kB +0.02% +18 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 105.43 kB +0.04% +38 B 🔺
@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.79 kB +0.05% +25 B 🔺
@sentry/vue 35.34 kB - -
@sentry/vue (incl. Tracing) 50.59 kB +0.09% +45 B 🔺
@sentry/svelte 30.33 kB - -
CDN Bundle 31.61 kB - -
CDN Bundle (incl. Tracing) 48.94 kB +0.1% +45 B 🔺
CDN Bundle (incl. Logs, Metrics) 33.8 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 50.85 kB +0.07% +35 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 74.31 kB - -
CDN Bundle (incl. Tracing, Replay) 86.5 kB +0.03% +24 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.35 kB +0.04% +35 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 92.21 kB +0.04% +28 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.16 kB +0.04% +35 B 🔺
CDN Bundle - uncompressed 93.84 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.77 kB +0.02% +26 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.14 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.46 kB +0.02% +26 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.08 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.04 kB +0.01% +26 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.71 kB +0.01% +26 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.73 kB +0.01% +26 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.4 kB +0.01% +26 B 🔺
@sentry/nextjs (client) 53.34 kB +0.1% +52 B 🔺
@sentry/sveltekit (client) 49.01 kB +0.04% +15 B 🔺
@sentry/core/server 65.41 kB +0.04% +23 B 🔺
@sentry/core/browser 51.76 kB +0.09% +43 B 🔺
@sentry/node 117.38 kB +0.02% +22 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.18 kB - -
@sentry/node - without tracing 82 kB +0.03% +22 B 🔺
@sentry/aws-serverless 91.36 kB +0.03% +26 B 🔺
@sentry/cloudflare (withSentry) - minified 194.46 kB - -
@sentry/cloudflare (withSentry) 480.88 kB - -

View base workflow run

@Lms24 Lms24 changed the title fix(nextjs): Resolve static routes to their own route template fix(nextjs): Treat static route pageload spans as low-cardinality route names Aug 24, 2026
@Lms24 Lms24 changed the title fix(nextjs): Treat static route pageload spans as low-cardinality route names fix(nextjs): Treat static route spans as low-cardinality route names Aug 24, 2026
@Lms24 Lms24 changed the title fix(nextjs): Treat static route spans as low-cardinality route names fix(nextjs): Treat static route span names as low-cardinality names Aug 24, 2026
@Lms24
Lms24 marked this pull request as ready for review August 24, 2026 09:34
@Lms24
Lms24 requested a review from a team as a code owner August 24, 2026 09:34
@Lms24
Lms24 requested review from chargome and nicohrubec and removed request for a team August 24, 2026 09:34
Base automatically changed from lms/feat-low-card-span-names-pageload to develop August 24, 2026 10:58
@Lms24
Lms24 requested a review from a team as a code owner August 24, 2026 10:58
@Lms24
Lms24 requested review from logaretm and msonnb and removed request for a team August 24, 2026 10:58
Lms24 and others added 2 commits August 24, 2026 12:58
`findMatchingRoutes` returned nothing for a path that exactly matched a static
route in the build-time manifest, so `maybeParameterizeRoute` reported it the
same way as a path it could not resolve at all: no manifest, a 404, or a route
excluded from the manifest. Static routes were therefore emitted with
`sentry.source: 'url'` and no `url.template`, even though a static route is its
own template - one with zero parameters - and is guaranteed low cardinality by
the finite build-time route list.

Return the route itself instead. Pageload, navigation, popstate and router-patch
spans all derive their name, source and `url.template` from that return value,
so static routes now carry `sentry.source: 'route'`. Under span streaming they
keep their path as the span name instead of collapsing to `Pageload`, which is
now reserved for paths the manifest genuinely cannot resolve.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Lms24
Lms24 force-pushed the lms/fix-nextjs-static-route-parameterization branch from b7a6a70 to b6f7b8f Compare August 24, 2026 10:58

@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 2 potential issues.

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 b6f7b8f. Configure here.

expect(serverSpan.trace_id).toBe(pageloadSpan.trace_id);
expect(pageloadSpan.attributes).toMatchObject({
['sentry.segment.name.source']: { value: 'url', type: 'string' },
['sentry.segment.name.source']: { value: 'route', type: 'string' },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Incomplete static route assertions

Low Severity

Flagged because the PR review guidelines ask to assert newly added payload data thoroughly. This test updates sentry.segment.name.source to route for the static /pageload-tracing pageload, but does not assert url.template, which sibling updates in this PR (for example the cacheComponents and parameterized static tests) do cover.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit b6f7b8f. Configure here.

expect(span.attributes).toMatchObject({
['sentry.segment.name.source']: { value: 'url', type: 'string' },
['url.path']: { value: '/parameterized/static', type: 'string' },
['url.path']: { value: '/this-route-does-not-exist', type: 'string' },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing negative template assertion

Low Severity

Flagged because the PR review guidelines call out relaxed matchers when a payload field is expected to be absent. This new unknown-route fallback test uses toMatchObject for source: 'url' but never asserts that url.template is missing, even though that attribute is only set when a manifest match exists.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit b6f7b8f. Configure here.

@Lms24
Lms24 merged commit ab38f68 into develop Aug 24, 2026
78 of 80 checks passed
@Lms24
Lms24 deleted the lms/fix-nextjs-static-route-parameterization branch August 24, 2026 11:47
Lms24 added a commit that referenced this pull request Aug 24, 2026
…23504)

Same as #23503

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
chargome added a commit that referenced this pull request Aug 24, 2026
…3537)

Aligns the `nextjs-orpc` pageload and navigation expectations with
#23503, which started annotating static routes as low-cardinality
(`source: 'route'`) but missed this app.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
JPeer264 pushed a commit that referenced this pull request Aug 25, 2026
…23503)

This PR fixes a "bug" in which we annotated static (paramter-less)
routes as high-cardinality (`source: 'url'`) unparamterized URL span
names. While these routes do not contain a parameter, we can still
guarantee that we resolved them to a static route (via the manifest
route matching), so we should annotate it as low card. (`source:
'route'`).

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
JPeer264 pushed a commit that referenced this pull request Aug 25, 2026
…23504)

Same as #23503

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
JPeer264 pushed a commit that referenced this pull request Aug 25, 2026
…3537)

Aligns the `nextjs-orpc` pageload and navigation expectations with
#23503, which started annotating static routes as low-cardinality
(`source: 'route'`) but missed this app.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

3 participants