Skip to content

feat(astro): Register astro route provider - #23792

Open
logaretm wants to merge 6 commits into
awad/route-provider-remixfrom
awad/route-provider-astro
Open

logaretm wants to merge 6 commits into
awad/route-provider-remixfrom
awad/route-provider-astro

Conversation

@logaretm

Copy link
Copy Markdown
Member

Registers a route provider for Astro from the sentry-route-name meta tag the middleware already injects into every rendered document.

Registered from init() rather than the tracing integration, so route parameterization no longer depends on tracing being enabled.

Unlike the Next.js and Remix providers this is not a matcher. The document only ever describes the page it rendered, so a URL other than the current one resolves to undefined rather than a guess. That guard is also what stops a navigation being named after the route it is leaving.

I checked the soft-navigation behaviour against Astro 5.18 with a throwaway app rather than assuming it. ClientRouter swaps the tag during astro:after-swap, at the same moment location changes, and does not accumulate duplicates, so reading it per call stays correct across client-side navigations and back/forward. It is only stale during a navigation, before the swap, which the current-path guard already excludes.

Part of #23556

@github-actions

github-actions Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.24 kB - -
@sentry/browser - with treeshaking flags 27.5 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.4 kB - -
@sentry/browser (incl. Tracing) 51.16 kB +0.02% +9 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 51.18 kB +0.02% +8 B 🔺
@sentry/browser (incl. Tracing, Profiling) 54.19 kB +0.02% +9 B 🔺
@sentry/browser (incl. Tracing, Replay) 90.77 kB +0.01% +8 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.87 kB +0.02% +9 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 95.47 kB +0.01% +7 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 108.42 kB +0.01% +8 B 🔺
@sentry/browser (incl. Feedback) 46.76 kB - -
@sentry/browser (incl. sendFeedback) 34.3 kB - -
@sentry/browser (incl. FeedbackAsync) 39.41 kB - -
@sentry/browser (incl. Metrics) 30.25 kB - -
@sentry/browser (incl. Logs) 30.51 kB - -
@sentry/browser (incl. Metrics & Logs) 31.18 kB - -
@sentry/react 31 kB - -
@sentry/react (incl. Tracing) 53.46 kB +0.03% +11 B 🔺
@sentry/vue 36.74 kB - -
@sentry/vue (incl. Tracing) 53.71 kB +0.02% +10 B 🔺
@sentry/svelte 29.26 kB - -
CDN Bundle 30.93 kB - -
CDN Bundle (incl. Tracing) 51.7 kB +0.03% +12 B 🔺
CDN Bundle (incl. Logs, Metrics) 33.2 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.67 kB +0.03% +11 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 73.92 kB - -
CDN Bundle (incl. Tracing, Replay) 89.29 kB +0.02% +9 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.25 kB +0.01% +9 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 95.46 kB +0.02% +11 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.43 kB +0.02% +12 B 🔺
CDN Bundle - uncompressed 91.4 kB - -
CDN Bundle (incl. Tracing) - uncompressed 153.81 kB +0.03% +41 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.97 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 159.77 kB +0.03% +41 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 227.54 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 273.54 kB +0.02% +41 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 279.48 kB +0.02% +41 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.25 kB +0.02% +41 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 293.17 kB +0.02% +41 B 🔺
@sentry/nextjs (client) 56.03 kB +0.46% +254 B 🔺
@sentry/sveltekit (client) 51.6 kB +0.02% +9 B 🔺
@sentry/core/server 39.96 kB +0.03% +11 B 🔺
@sentry/core/browser 13.63 kB - -
@sentry/node 133.91 kB +0.02% +16 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.43 kB - -
@sentry/node - without tracing 90.47 kB +0.04% +28 B 🔺
@sentry/node - without channel injection 112.42 kB +0.02% +20 B 🔺
@sentry/aws-serverless 98.72 kB +0.02% +14 B 🔺
@sentry/cloudflare (withSentry) - minified 206.53 kB +0.03% +49 B 🔺
@sentry/cloudflare (withSentry) 513.8 kB +0.02% +70 B 🔺

View base workflow run

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you apply the label PR: no-auto-close I will leave it alone ... forever!

@logaretm
logaretm force-pushed the awad/route-provider-astro branch 2 times, most recently from e2e9043 to 8d918ed Compare September 24, 2026 18:14
@logaretm
logaretm force-pushed the awad/route-provider-astro branch 2 times, most recently from e2504e2 to b3d3aa2 Compare September 24, 2026 18:50
@logaretm
logaretm force-pushed the awad/route-provider-astro branch 2 times, most recently from 47c9fed to 5cca66c Compare September 24, 2026 19:59
@logaretm logaretm changed the title feat(astro): Register a route provider backed by the route meta tag feat(astro): Register astro route provider Sep 24, 2026
@logaretm

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.

Reviewed by Cursor Bugbot for commit 5cca66c. Configure here.

Comment thread packages/astro/src/client/routeProvider.ts
The middleware already injects the parameterized route into the document it
renders, but it was only readable from the pageload instrumentation.

Registered from `init()` rather than the tracing integration, so route
parameterization no longer depends on tracing being enabled.

Not a matcher: the document only describes the page it rendered, so a URL other
than the current one resolves to undefined rather than a guess. Verified against
Astro 5.18 that `ClientRouter` swaps the tag during `astro:after-swap", at the
same moment `location` changes, so reading it per call stays correct across soft
navigations and back/forward.
@logaretm
logaretm force-pushed the awad/route-provider-astro branch from 5cca66c to bccce36 Compare September 24, 2026 21:20
@logaretm
logaretm marked this pull request as ready for review September 24, 2026 21:25
@logaretm
logaretm requested a review from a team as a code owner September 24, 2026 21:25
@logaretm
logaretm requested review from chargome and removed request for a team September 24, 2026 21:25
@logaretm
logaretm requested a review from nicohrubec September 24, 2026 21:25

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant