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
Copy file name to clipboardExpand all lines: docs/platforms/javascript/guides/nuxt/features/component-tracking.mdx
+52-59Lines changed: 52 additions & 59 deletions
Original file line number
Diff line number
Diff line change
@@ -4,101 +4,94 @@ description: "Learn how to monitor the rendering performance of your application
4
4
sidebar_order: 10
5
5
---
6
6
7
-
Sentry's Nuxt SDK has a component-tracking feature that lets you monitor the performance of your Vue components. Enabling this feature provides you with spans in your transactions that represent the component lifecycle events and durations. This allows you to get a drilled-down view into how your components are behaving so you can do things like identify slow initializations or frequent updates, which might be impacting your app's performance.
7
+
Sentry's Nuxt SDK offers a feature to monitor the performance of your Vue components: component tracking. Enabling this feature provides you with spans in your transactions that represent the component lifecycle events and durations. This allows you to get a drilled-down view into how your components are behaving so you can do things like identify slow initializations or frequent updates, which might have an impact on your app's performance.
8
8
9
9
## Usage
10
10
11
11
<Alert>
12
12
13
-
To set up component tracking, you need to first configure performance monitoring. For details on how to do this, check out our [Performance documentation](/platforms/javascript/guides/nuxt/performance/).
13
+
To set up component tracking, you need to first configure tracing. For details on how to do this, check out our [Tracing documentation](/platforms/javascript/guides/nuxt/performance/).
14
14
15
15
</Alert>
16
16
17
17
### Initial Application Load
18
18
19
19
By default, the Nuxt SDK tracks the rendering performance of your app (that is, its root component) on the initial page load. This operation is represented in the page load transaction by the **`ui.vue.render`** span.
20
20
21
-
### Child Components
21
+
### Child Component Tracking
22
22
23
23
You can also track your app's child components to get more details about the rendering process. This feature will create spans for each tracked component instance. The spans are called **`ui.vue.[hook]`** where `[hook]` is replaced by each tracked lifecycle stage. For example, the span representing the mount stage (the time between `beforeMount` and `mounted`) is called `ui.vue.mount`.
24
24
25
-
To set it up, add [`trackComponents`](#trackcomponents) in your `Sentry.init` call. You can also optionally add [`hooks`](#hooks), and [`timeout`](#timeout).
25
+
To set it up, add the `vueIntegration` to your `Sentry.init()` call and, set the `tracingOptions.trackComponents` option.
26
+
Pass `true` to track all of your child components, or specify a list of individual comopnents you want to track:
26
27
27
-
#### `trackComponents`
28
+
```javascript {5-17}
29
+
import*asSentryfrom"@sentry/nuxt";
28
30
29
-
This is the main option that controls which child components should be tracked. Set it to `true` to track all of them or specify a list of individual components you want to track:
30
-
31
-
```javascript
32
31
Sentry.init({
33
-
// ...
34
-
trackComponents:true,
35
-
// OR
36
-
trackComponents: [
37
-
"App",
38
-
"RwvHeader",
39
-
"RwvFooter",
40
-
"RwvArticleList",
41
-
"Pagination",
32
+
integrations: [
33
+
Sentry.vueIntegration({
34
+
tracingOptions: {
35
+
trackComponents:true,
36
+
// OR
37
+
trackComponents: [
38
+
"App",
39
+
"RwvHeader",
40
+
"RwvFooter",
41
+
"RwvArticleList",
42
+
"Pagination",
43
+
],
44
+
},
45
+
}),
42
46
],
43
47
});
44
48
```
45
49
46
-
The default is `false`.
50
+
The default value for `trackComponents` is `false`.
51
+
52
+
#### Track Specific Component Lifecycle Hooks
47
53
48
-
#### `hooks`
54
+
You can control which lifecycle hooks should be tracked. This is helpful if, for example, you want to know if some components are removed during the initial page load, in which case you can configure the integration to also track `unmount` hooks:
49
55
50
-
Control which lifecycle hooks should be tracked. This is helpful if, for example, you want to know if some components are removed during the initial page load, in which case you can add an `unmount` hook to the default:
56
+
```javascript {8}
57
+
import*asSentryfrom"@sentry/nuxt";
51
58
52
-
```javascript
53
59
Sentry.init({
54
-
// ...
55
-
trackComponents:true
56
-
hooks: ["mount", "update", "unmount"],
60
+
integrations: [
61
+
Sentry.vueIntegration({
62
+
tracingOptions: {
63
+
trackComponents:true
64
+
hooks: ["mount", "update", "unmount"],
65
+
},
66
+
}),
67
+
],
57
68
});
58
69
```
59
70
60
-
The following hooks are available to track in Vue 3: `['activate', 'create', 'unmount', 'mount', 'update']`
61
-
62
-
Note, that when specifying `hooks`, we use the simple verb rather than `before` and `-ed` pairs. For example, `unmount` is correct, while `beforeUnmount` and `unmounted` are incorrect.
71
+
The default set of tracked hooks is `['activate', 'mount', 'update']`.
63
72
64
-
<Alert>
65
-
66
-
If you're using Vue 2, use `destroy` instead of `unmount`. But in Vue 3 `destroy` doesn't work because the names of the lifecycle hooks themselves [changed](https://v3-migration.vuejs.org/breaking-changes/#other-minor-changes).
73
+
The following hooks are available to track: `['activate', 'create', 'unmount', 'mount', 'update']`
67
74
68
-
</Alert>
75
+
Note that when specifying `hooks`, we use the simple verb rather than `before` and `-ed` pairs. For example, `unmount` is correct, while `beforeUnmount` and `unmounted` are incorrect.
69
76
70
-
The default set of hooks is `['activate', 'mount', 'update']`.
77
+
#### Configure a Timeout for Component Tracking
71
78
72
-
#### `timeout`
79
+
You can specify how long the root rendering span should wait for the last component to render by configuring the `timeout` option in milliseconds.
80
+
Every new rendering cycle debounces the timeout, and it starts counting from the beginning. Once the timeout is reached, tracking is completed, and all the rendering information is sent to Sentry:
73
81
74
-
You can specify how long the root rendering span should wait until the last component is rendered.
75
-
Every new rendering cycle debounces the timeout and it starts counting from the beginning. Once the timeout is reached, tracking is completed and all the rendering information is sent to Sentry:
82
+
```javascript {8}
83
+
import*asSentryfrom"@sentry/nuxt";
76
84
77
-
```javascript
78
85
Sentry.init({
79
-
// ...
80
-
trackComponents:true,
81
-
timeout:500,
86
+
integrations: [
87
+
Sentry.vueIntegration({
88
+
tracingOptions: {
89
+
trackComponents:true,
90
+
timeout:500, // milliseconds
91
+
},
92
+
}),
93
+
],
82
94
});
83
95
```
84
96
85
-
The default is `2000`.
86
-
87
-
#### Alternative Configuration With `tracingOptions`
88
-
89
-
You can also group the component-tracking options by using the optional `tracingOptions` property in `Sentry.init`:
90
-
91
-
```javascript
92
-
Sentry.init({
93
-
// ...
94
-
tracingOptions: {
95
-
trackComponents:true;
96
-
timeout:500;
97
-
hooks: ['mount', 'update'];
98
-
}
99
-
})
100
-
```
101
-
102
-
Note, that when you use this property there is no change in behaviour, as opposed to when you use the three top-level properties described above.
103
-
104
-
The default value for `tracingOptions` is `undefined`.
Copy file name to clipboardExpand all lines: docs/platforms/javascript/guides/vue/features/component-tracking.mdx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ By default, the Vue SDK tracks the rendering performance of your app (that is, i
23
23
You can also track your app's child components to get more details about the rendering process. This feature will create spans for each tracked component instance. The spans are called **`ui.vue.[hook]`** where `[hook]` is replaced by each tracked lifecycle stage. For example, the span representing the mount stage (the time between `beforeMount` and `mounted`) is called `ui.vue.mount`.
24
24
25
25
To set it up, add the Vue Integration to your `Sentry.init()` call and, set the `tracingOptions.trackComponents` option.
26
-
Set the `trackComponent` option to`true` to track all of your child components, or specify a list of individual comopnents you want to track:
26
+
Pass`true` to track all of your child components, or specify a list of individual comopnents you want to track:
0 commit comments