Skip to content

feat(astro): Register a route provider backed by the route meta tag - #23792

Draft
logaretm wants to merge 1 commit into
awad/route-provider-remixfrom
awad/route-provider-astro
Draft

feat(astro): Register a route provider backed by the route meta tag#23792
logaretm wants to merge 1 commit 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

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.
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.56 kB added added
@sentry/browser - with treeshaking flags 26.92 kB added added
@sentry/browser - with treeshaking flags tracing without tracing 26.82 kB added added
@sentry/browser (incl. Tracing) 48.75 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 48.76 kB added added
@sentry/browser (incl. Tracing, Profiling) 51.68 kB added added
@sentry/browser (incl. Tracing, Replay) 88.23 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.63 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 92.93 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 105.85 kB added added
@sentry/browser (incl. Feedback) 46.05 kB added added
@sentry/browser (incl. sendFeedback) 33.62 kB added added
@sentry/browser (incl. FeedbackAsync) 38.73 kB added added
@sentry/browser (incl. Metrics) 29.51 kB added added
@sentry/browser (incl. Logs) 29.8 kB added added
@sentry/browser (incl. Metrics & Logs) 30.43 kB added added
@sentry/react 30.3 kB added added
@sentry/react (incl. Tracing) 50.94 kB added added
@sentry/vue 35.73 kB added added
@sentry/vue (incl. Tracing) 51.02 kB added added
@sentry/svelte 28.59 kB added added
CDN Bundle 30.72 kB added added
CDN Bundle (incl. Tracing) 49.77 kB added added
CDN Bundle (incl. Logs, Metrics) 32.98 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 51.66 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 73.51 kB added added
CDN Bundle (incl. Tracing, Replay) 87.24 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 89.09 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 93.13 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 95.06 kB added added
CDN Bundle - uncompressed 91.23 kB added added
CDN Bundle (incl. Tracing) - uncompressed 148.48 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.53 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 154.17 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 226.69 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.98 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 273.65 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.68 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 287.35 kB added added
@sentry/nextjs (client) 53.97 kB added added
@sentry/sveltekit (client) 49.19 kB added added
@sentry/core/server 65.67 kB added added
@sentry/core/browser 52.26 kB added added
@sentry/node 123.77 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.53 kB added added
@sentry/node - without tracing 88.03 kB added added
@sentry/node - without channel injection 103.18 kB added added
@sentry/aws-serverless 96.42 kB added added
@sentry/cloudflare (withSentry) - minified 201.04 kB added added
@sentry/cloudflare (withSentry) 500.26 kB added added

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.

1 participant