Conversation
size-limit report 📦
|
|
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 |
a1394dd to
ece4da5
Compare
ece4da5 to
a309ce7
Compare
a309ce7 to
3dbcc53
Compare
3dbcc53 to
227053e
Compare
22d7992 to
e741e61
Compare
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e741e61. Configure here.
`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.
e741e61 to
b344925
Compare
| */ | ||
| export function createVueRouteProvider(getRouter: () => InstalledRouter | undefined): RouteProvider { | ||
| return createUrlRouteProvider(url => { | ||
| const resolved = getRouter()?.resolve?.(`${url.pathname}${url.search}${url.hash}`); |
There was a problem hiding this comment.
With createWebHashHistory every URL has pathname / and the route lives in the hash, so e.g. resolve('/#/users/42') matches the shell route and we'd report / for every page. Could we detect hash history off router.options.history and bail to undefined (or resolve from the hash) instead?
see https://router.vuejs.org/api/functions/createWebHashHistory.html
| export { attachErrorHandler } from './errorhandler'; | ||
| export { createTracingMixins } from './tracing'; | ||
| export { vueIntegration } from './integration'; | ||
| export { createVueRouteProvider } from './routeProvider'; |
There was a problem hiding this comment.
maybe we should prefix this with _INTERNAL_ as users are not supposed to use this, right? Just Nuxt
| /** | ||
| * Reads the router `vue-router` installed onto a Vue app. | ||
| */ | ||
| export function getRouterFromApp(app: unknown): InstalledRouter | undefined { |
There was a problem hiding this comment.
| export function getRouterFromApp(app: unknown): InstalledRouter | undefined { | |
| export function getRouterFromApp(app: Vue | Vue[] | undefined): InstalledRouter | undefined { |
Should we do this maybe?
| 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)) }), |
There was a problem hiding this comment.
What if someone passes app to vueIntegration? Will/Should they still get the provider?
| 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)) }), |
There was a problem hiding this comment.
In Vue 2, this would be options.App (make sure to also test Vue 2 E2E)

Registers a route provider for Vue, read off the Vue app the SDK is already given.
vue-routersetsapp.config.globalProperties.$routerwhen 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 passroutertobrowserTracingIntegration, 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 ofSentry.init().Returns the matched path rather than
route.name, even underrouteLabel: 'name'. Callers seturl.templatefrom 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