feat(vue): Rework tracing and add support for Vue 3#3804
Conversation
size-limit report
|
|
Thanks for this incredible PR, I will try it when I have free time! Just a question, I see you inject |
|
I didn't know that multiple Vue apps it's actually a thing, but here you go :) const appOne = Vue.createApp(App);
const appTwo = Vue.createApp(App);
const appThree = Vue.createApp(App);
Sentry.init({
app: [appOne, appTwo, appThree],
}); |
|
Nice, thanks! I (we) have another advanced usecase with multiples Vue instances on a single page. On server-rendered websites, sometimes we create small components (and Vue instances) to add some interactivity on the page (e.g.: dropdowns, inputs with characters counters, modals...), but thoses instances are often created after Sentry has been initialized (since we initialize Sentry the ASAP). It was not a problem with Vue 2, but Vue 3 it is. 😕 Do you think it would be possible to listen on every Thanks! |
import * as Sentry from '@sentry/vue';
// ...
const app = createApp(App);
Sentry.init({
app: app
// ...
});
const miscApp = createApp(MiscApp);
miscApp.mixin(Sentry.createTracingMixins({ trackComponents: true }));
Sentry.attachErrorHandler(miscApp, { logErrors: true });Although not a common use case I believe, this should do the job. |
|
That's awesome! Even if it's more verbose than a single Thanks for this! ❤️ |
|
@AbhiPrasad updated |
AbhiPrasad
left a comment
There was a problem hiding this comment.
Wonder if we can ping someone in that Vue 3 GH issue or through the Vue community discord to get some more 👀 on it.
|
@vaaski |
|
You're right, my bad. Works like a charm now! |
|
How use it with import { Vue as VueIntegration} from '@sentry/integrations';
Sentry.init({
dsn: import.meta.env.VITE_SENTRY_DSN,
integrations: [
new VueIntegration({ ??? }),
],
});I tried: new VueIntegration({ app }),but I got TS error: |
|
You don't. Vue integration predates a standalone Vue sdk. It has been replaced by it now. |
|
Seems this change introduces a type error, the Therefore TypeScript complains that I can't pass my router into Is this expected and should I adjust my code or is this a newly introduced bug? Please let me know if I should open a separate issue for this. |
|
@mac-cain13 fix is coming |


The examples below show how to use Error Tracking and Performance Tracing features. In case you don't want to use Performance Tracing,
integrations,tracesSampleRate,hooks, andtrackComponentscan be omited.Vue 2
Vue 3
Vue 3 - multiple apps
Vue 3 - adding app after initialization