sentry-javascript
sentry-javascript copied to clipboard
[vue] Router instrumentation logs route name if set; missing option to log path instead
Problem Statement
My Vue routes are configured with path and name. (Route names are optional in Vue Router.)
In Sentry, I need paths logged, not route names. In fact: Full paths, including the base path of the SPA.
The current Vue Router Sentry instrumentation chooses the name, if it is set, and falls back to the path only if no route name has been configured.
Solution Brainstorm
New options for vue router instrumentation:
- Log navigation as route name
- Include route parameters
- Yes
- No
- Include route parameters
- Log navigation as route path
- Include route parameters
- Yes, log path with inserted parameters (as in the URL bar)
- No, log path with route parameter placeholders
- Include SPA base path
- Yes
- No
- Include route parameters
Thanks @LeoniePhiline, sounds like a solid idea.
We are a bit overwhelmed with other things at the moment, namely, pushing our v7 out. We can look into this in the upcoming weeks-months. If you need this enabled sooner, feel free to submit a PR and we will review it.
Hi,
we've merged a change that allows to opt-in for this via:
vueRouterInstrumentation(vueRouter, { routeLabel: 'path' });
This will go out in the next release!
This has been released in 7.41.0!
Fantastic! 🚀
Questions regarding the “Solutions Brainstorm” in the above issue description:
Is this capturing route parameter placeholders, or replaced route parameters (= route as in the URL bar)?
And does it include or exclude the SPA base path?
Is it possible to add options for these (even if at a later point, in a new PR)?
For now, we only allow to opt-in to always use the path vs. the name. The other options are things we do not want to support, as we don't want unparametrized route names (so with route params) there because that breaks grouping etc.
For including the SPA base path, why would you want this? As this will be mostly static. IMHO a better solution if you want to differentiate between different hosts where something is hosted is to e.g. add a tag or so to differentiate those.
If you still think this is esp. important to you, I'd ask you to create a new issue for this, so we can track this separately!