New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(vue): Allow to set routeLabel: 'path'
to opt-out of using name
#7326
Conversation
packages/vue/src/types.ts
Outdated
|
||
/** | ||
* What to use for route labels. | ||
* By default, we use route.name (if set) and else the path. | ||
* | ||
* Default: 'name' | ||
*/ | ||
routeLabel: 'name' | 'path'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
h: Instead of making this a top level option, wdyt about adding this as an option to the routing instrumentation?
packages/vue/src/router.ts
Outdated
@@ -38,6 +39,9 @@ interface VueRouter { | |||
* @param router The Vue Router instance that is used | |||
*/ | |||
export function vueRouterInstrumentation(router: VueRouter): VueRouterInstrumentation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RE other comment:
I'd add a second optional parameter with a VueRouterInstrumentationOptions
object here, in which routeLabel
would live
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a much better idea 👍
Updated it to be an option for the router, which makes much more sense! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for moving the option - LGTM!
expect(mockStartTransaction).toHaveBeenLastCalledWith({ | ||
name: '/login', | ||
metadata: { | ||
source: 'route', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually 'route' or shouldn't this be 'url' now? This has an impact on dynamic sampling and the performance product.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just disables using the name
, so it uses the parametrized route when available and falls back to the URL if not.
See:
let transactionName: string = to.path; |
This adds a new option
routeLabel
for the vue SDK which allows to configure if you want to use the routename
, if it is set.When setting this to
path
(default isname
), we'll always use the path of the route even if a name exists.Usage:
Closes #5013