-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(vue): Add transaction source to VueRouter instrumentation #5381
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
Conversation
@@ -83,7 +83,7 @@ export const createTracingMixins = (options: TracingOptions): Mixins => { | |||
// Skip components that we don't want to track to minimize the noise and give a more granular control to the user | |||
const name = formatComponentName(this, false); | |||
const shouldTrack = Array.isArray(options.trackComponents) | |||
? options.trackComponents.includes(name) | |||
? options.trackComponents.indexOf(name) > -1 |
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.
Couldn't get tests to work because there was a type error here. I could have messed with tsconfigs but there is an upside of doing indexOf() instead of includes() which is backwards compatibility. I think includes is ES6 only.
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.
Lol, coincidence? #5389
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.
Nice, LGTM 🚀
packages/vue/src/router.ts
Outdated
@@ -51,23 +62,38 @@ export function vueRouterInstrumentation(router: VueRouter): VueRouterInstrument | |||
query: to.query, | |||
}; | |||
|
|||
// Determine a name for the routing transaction and where that name came from | |||
let transactionName: string = to.path; | |||
let transactionSource: 'url' | 'custom' | 'route' = 'url'; |
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.
Totally optional but wdyt about extracting'url' | 'custom' | 'route'
to a type like in the ReactRouterV3 implementation? Just for consistency...
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.
Right, at the time of opening this I didn't see that we exported the TransactionSource type. Thanks!
Ref: #5345
Set transaction source on the VueRouter instrumentation and update the route types (this more acts like documentation).