Skip to content

feat(vue): Register Vue route provider - #23793

Open
logaretm wants to merge 7 commits into
awad/route-provider-astrofrom
awad/route-provider-vue-app
Open

logaretm wants to merge 7 commits into
awad/route-provider-astrofrom
awad/route-provider-vue-app

Conversation

@logaretm

Copy link
Copy Markdown
Member

Registers a route provider for Vue, read off the Vue app the SDK is already given.

vue-router sets app.config.globalProperties.$router when it installs, so the provider needs no new option and no router passed to the tracing integration. That means it works for users who never pass router to browserTracingIntegration, and route parameterization no longer depends on tracing being enabled.

The router is looked up per call rather than captured at registration, because app.use(router) may legitimately run either side of Sentry.init().

Returns the matched path rather than route.name, even under routeLabel: 'name'. Callers set url.template from this and a route name is an identifier, not a template. The navigation instrumentation still names the span after the route name when the user asked for it.

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.51 kB +0.51% +148 B 🔺
@sentry/browser - with treeshaking flags 27.68 kB +0.13% +34 B 🔺
@sentry/browser - with treeshaking flags tracing without tracing 27.58 kB +0.14% +38 B 🔺
@sentry/browser (incl. Tracing) 51.46 kB +0.31% +154 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 51.47 kB +0.3% +149 B 🔺
@sentry/browser (incl. Tracing, Profiling) 54.47 kB +0.31% +164 B 🔺
@sentry/browser (incl. Tracing, Replay) 91.05 kB +0.18% +155 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.03 kB +0.05% +36 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 95.73 kB +0.16% +150 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 108.72 kB +0.14% +149 B 🔺
@sentry/browser (incl. Feedback) 47.04 kB +0.33% +154 B 🔺
@sentry/browser (incl. sendFeedback) 34.57 kB +0.42% +144 B 🔺
@sentry/browser (incl. FeedbackAsync) 39.69 kB +0.37% +143 B 🔺
@sentry/browser (incl. Metrics) 30.53 kB +0.51% +153 B 🔺
@sentry/browser (incl. Logs) 30.82 kB +0.5% +152 B 🔺
@sentry/browser (incl. Metrics & Logs) 31.48 kB +0.47% +147 B 🔺
@sentry/react 31.36 kB +0.53% +165 B 🔺
@sentry/react (incl. Tracing) 53.82 kB +0.29% +153 B 🔺
@sentry/vue 37.51 kB +1.65% +607 B 🔺
@sentry/vue (incl. Tracing) 54.36 kB +0.89% +476 B 🔺
@sentry/svelte 29.54 kB +0.5% +146 B 🔺
CDN Bundle 31.22 kB +0.13% +39 B 🔺
CDN Bundle (incl. Tracing) 51.99 kB +0.08% +41 B 🔺
CDN Bundle (incl. Logs, Metrics) 33.46 kB +0.1% +31 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 53.94 kB +0.1% +49 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 74.2 kB +0.07% +49 B 🔺
CDN Bundle (incl. Tracing, Replay) 89.56 kB +0.04% +34 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.54 kB +0.05% +45 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 95.73 kB +0.04% +33 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.73 kB +0.07% +60 B 🔺
CDN Bundle - uncompressed 92.14 kB +0.11% +95 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 154.53 kB +0.07% +95 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 98.71 kB +0.1% +95 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 160.48 kB +0.06% +95 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 228.28 kB +0.05% +95 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 274.26 kB +0.04% +95 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 280.2 kB +0.04% +95 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.96 kB +0.04% +95 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 293.89 kB +0.04% +95 B 🔺
@sentry/nextjs (client) 56.32 kB +0.74% +413 B 🔺
@sentry/sveltekit (client) 51.88 kB +0.29% +145 B 🔺
@sentry/core/server 39.99 kB - -
@sentry/core/browser 13.63 kB - -
@sentry/node 144.03 kB +0.01% +8 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.98 kB - -
@sentry/node - without tracing 92.91 kB +0.01% +9 B 🔺
@sentry/node - without channel injection 122.41 kB +0.01% +9 B 🔺
@sentry/aws-serverless 101.17 kB -0.01% -9 B 🔽
@sentry/cloudflare (withSentry) - minified 206.69 kB - -
@sentry/cloudflare (withSentry) 514.13 kB - -

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-vue-app branch from a1394dd to ece4da5 Compare September 24, 2026 18:04
@logaretm
logaretm force-pushed the awad/route-provider-vue-app branch from ece4da5 to a309ce7 Compare September 24, 2026 18:14
@logaretm
logaretm force-pushed the awad/route-provider-vue-app branch from a309ce7 to 3dbcc53 Compare September 24, 2026 18:30
@logaretm
logaretm force-pushed the awad/route-provider-vue-app branch from 3dbcc53 to 227053e Compare September 24, 2026 18:50
@logaretm
logaretm force-pushed the awad/route-provider-vue-app branch 2 times, most recently from 22d7992 to e741e61 Compare September 24, 2026 19:59
@logaretm logaretm changed the title feat(vue): Register a route provider read off the Vue app feat(vue): Register Vue 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.

Stale Bugbot comment from a previous run.

Comment thread packages/vue/src/routeProvider.ts
Comment thread packages/vue/test/routeProvider.test.ts
@logaretm
logaretm force-pushed the awad/route-provider-vue-app branch from e741e61 to b344925 Compare September 24, 2026 21:20
@logaretm
logaretm marked this pull request as ready for review September 24, 2026 21:26
@logaretm
logaretm requested a review from a team as a code owner September 24, 2026 21:26
@logaretm
logaretm requested review from chargome, nicohrubec and s1gr1d and removed request for a team September 24, 2026 21:26
Comment thread packages/vue/src/routeProvider.ts Outdated
Comment thread packages/vue/src/index.ts Outdated
Comment thread packages/vue/src/routeProvider.ts Outdated
Comment thread packages/vue/src/sdk.ts Outdated
Comment thread packages/vue/src/sdk.ts Outdated
defaultIntegrations: [...getDefaultIntegrations(options), vueIntegration()],
// The router is read off the app on each call, so `app.use(router)` can run either side of `init`, and
// users who never pass `router` to the tracing integration still get parameterized routes.
...(options.app && { routeProvider: createVueRouteProvider(() => getRouterFromApp(options.app)) }),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In Vue 2, this would be options.App (make sure to also test Vue 2 E2E)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

do we have a Vue 2 E2E? should I add one?

@logaretm
logaretm force-pushed the awad/route-provider-vue-app branch from b344925 to fa6bf94 Compare September 28, 2026 22:08
@github-actions

Copy link
Copy Markdown
Contributor

👋 @chargome, @nicohrubec — Please review this PR when you get a chance!

@logaretm
logaretm force-pushed the awad/route-provider-vue-app branch from fa6bf94 to 57914a9 Compare September 29, 2026 19:34

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

Stale Bugbot comment from a previous run.

Comment thread packages/vue/src/sdk.ts Outdated
@logaretm
logaretm force-pushed the awad/route-provider-vue-app branch from 57914a9 to 63d9a6f Compare September 30, 2026 16:49
@logaretm
logaretm force-pushed the awad/route-provider-vue-app branch from 63d9a6f to 8a6336a Compare September 30, 2026 16:52
@logaretm
logaretm force-pushed the awad/route-provider-vue-app branch from 8a6336a to 3f219dc Compare September 30, 2026 17:00
`vue-router` sets `app.config.globalProperties.$router` when it installs, and the
SDK is already given the app, so the provider needs no new option and no router
passed to the tracing integration.

Registered from `init()`, so route parameterization no longer depends on tracing
being enabled and works for users who never pass `router` to
`browserTracingIntegration`. The router is looked up per call rather than
captured, because `app.use(router)` may run either side of `Sentry.init()`.

Returns the matched path rather than `route.name` even under
`routeLabel: 'name'`: callers set `url.template` from this and a route name is an
identifier, not a template. The navigation instrumentation still names the span
after the route name when the user asked for it.
@logaretm
logaretm force-pushed the awad/route-provider-vue-app branch from 3f219dc to 0b03209 Compare September 30, 2026 17:02

@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 89d893e. Configure here.

// The router is looked up lazily because it may be installed after `init`. A user's `routeProvider` wins.
if (!getRouteProvider(client)) {
const { app, Vue } = options;
const getRouter = app ? () => getRouterFromApp(app) : captureRouterFromVue(Vue!);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Non-null assertion lacks required comment

Low Severity

A new non-null assertion on Vue has no comment explaining why a safer type is not possible. The earlier app/Vue guard makes the assertion valid, but the project rule still requires that comment on new ! uses in SDK source. Flagged because this was mentioned in the review rules file.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 89d893e. Configure here.

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.

2 participants