GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(nuxt): Add vue-router instrumentation by s1gr1d · Pull Request #13054 · getsentry/sentry-javascript Conversation
|
| export default defineNuxtPlugin(nuxtApp => { | ||
| nuxtApp.hook('app:created', vueApp => { | ||
| const sentryClient = getClient(); | ||
| const sentryClient = getClient(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
l: We can early return if client is not defined to remove the if (sentryClient) checks below.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'd rather leave the checks as I'm also accessing the client in a Nuxt lifecycle hook and I cannot be sure that the early return would hinder the lifecycle hook to be called if there is no client. Does this make sense?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean. I think then we need a new call to getClient inside the hook so we ensure that we always have an up-to-date reference.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| type SourceMapsOptions = { | ||
| /** | ||
| * Options for the Sentry Vite plugin to customize the source maps upload process. | ||
| * If this flag is `true`, and an auth token is detected, the Sentry integration will |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
l (sorry for the bike shedding): Just was wondering if "integration" is a good term here? IIUC users interact with our nuxt module here, correct? So I'd go with module or just SDK.
| * If this flag is `true`, and an auth token is detected, the Sentry integration will | |
| * If this flag is `true`, and an auth token is detected, the Sentry integration will |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (sentryClient && '$router' in nuxtApp) { | ||
| sentryClient.addIntegration( | ||
| browserTracingIntegration({ router: nuxtApp.$router as VueRouter, routeLabel: 'path' }), | ||
| ); | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
m: This is runtime code, right? If so, I think we need to add the __SENTRY_TRACING__ guard here to enable tree shaking of browserTracingIntegration.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing my review! LGTM!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Nuxt: Route Parametrization
There was an error while loading. Please reload this page.