You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Vue Tracing Integration allows you to track rendering performance during an initial application load.
622
+
623
+
Sentry injects a handler inside Vue's `beforeCreate` mixin, providing access to a Vue component during its life cycle stages.
624
+
When Sentry encounters a component named `root`, which is a top-level Vue instance (as in `new Vue({})`), we use our AM Tracing integration,
625
+
and create a new activity named `Vue Application Render`. Once the activity has been created, it will wait until all of its child components render, and there aren't new rendering events triggered within the configured `timeout`, before marking the activity as completed.
626
+
627
+
The described instrumentation functionality will give you very high-level information about the rendering performance of the Vue instance. However, the integration can also provide more fine-grained details about what actually happened during a specific activity.
628
+
To do that, you need to specify which components to track and what hooks to listen to (you can find a list of all available hooks [here](https://vuejs.org/v2/api/#Options-Lifecycle-Hooks)). You can also turn on tracking for all the components. However, it may be rather noisy if your app consists of hundreds of components. We encourage being more specific. If you don't provide hooks, Sentry will track a component's `mount` and `update` hooks.
629
+
630
+
Note that we don't use `before` and `-ed` pairs for hooks, and you should provide a simple verb instead. For example, `update` is correct. `beforeUpdate` and `updated` are incorrect.
631
+
632
+
To set up the Vue Tracing Integration, you will first need to configure the AM Tracing integration itself. For details on how to do this, see the [JavaScript]({%- link _documentation/performance/distributed-tracing.md -%}#javascript) section above.
633
+
Once you've configured the Tracing integration, move on to configuring the Vue integration itself.
634
+
Sentry built the new tracing capabilities into the original Vue error handler integrations, so there is no need to add any new packages. You only need to provide an appropriate configuration.
635
+
636
+
The most basic configuration for tracing your Vue app, which would track only the top-level component, looks like this:
You can specify how long a top-level activity should wait for the last component to render.
695
+
Every new rendering cycle is debouncing the timeout, and it starts counting from the beginning. Once the timeout is reached, tracking is completed, and all the information is sent to Sentry.
696
+
697
+
```js
698
+
newVueIntegration({
699
+
Vue,
700
+
tracing:true,
701
+
tracingOptions: {
702
+
trackComponents:true,
703
+
timeout:4000
704
+
}
705
+
})
706
+
```
707
+
708
+
#### Configuration
709
+
710
+
```js
711
+
/**
712
+
* When set to `true`, enables tracking of components lifecycle performance.
713
+
* Default: false
714
+
*/
715
+
tracing: boolean;
716
+
tracingOptions: {
717
+
/**
718
+
* Decides whether to track components by hooking into its lifecycle methods.
719
+
* Can be either set to `boolean` to enable/disable tracking for all of them.
720
+
* Or to an array of specific component names (case-sensitive).
721
+
* Default: false
722
+
*/
723
+
trackComponents: boolean | string[];
724
+
/**
725
+
* How long to wait (in ms) until the tracked root activity is marked as finished and sent to Sentry
726
+
* Default: 2000
727
+
*/
728
+
timeout: number;
729
+
/**
730
+
* List of hooks to keep track of during component lifecycle.
0 commit comments