Skip to content

Commit fd57b07

Browse files
authored
feat: extend guides in docs and add simpler way to enable Replay (#559)
1 parent 9099ddb commit fd57b07

17 files changed

+218
-67
lines changed

docs/content/en/sentry/options.md renamed to docs/content/en/configuration/options.md

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
title: Options
33
description: 'Options can be passed to Sentry using either environment variables'
4-
position: 4
5-
category: Sentry
4+
position: 15
5+
category: Configuration
66
---
77

88
Options can be passed using either:
99
- environment variables
1010
- `sentry` object in `nuxt.config.js`
1111
- when registering the module: `modules: [['@nuxtjs/sentry', {/*options*/}]]`
1212

13-
The `config`, `serverConfig` and `clientConfig` options can also be configured using [Runtime Config](/sentry/runtime-config).
13+
The `config`, `serverConfig` and `clientConfig` options can also be configured using [Runtime Config](/configuration/runtime-config).
1414

1515
The `dsn` is the only option that is required to enable Sentry reporting.
1616

@@ -123,13 +123,13 @@ The `dsn` is the only option that is required to enable Sentry reporting.
123123
- Default: `sentry`
124124
- Specified object in Nuxt config in `publicRuntimeConfig[runtimeConfigKey]` will override some options at runtime. See documentation at https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-runtime-config/
125125
- Used to define the environment at runtime for example
126-
- See also [Runtime Config](/sentry/runtime-config) documentation.
126+
- See also [Runtime Config](/configuration/runtime-config) documentation.
127127
128128
### disabled
129129
130130
- Type: `Boolean`
131131
- Default: `process.env.SENTRY_DISABLED || false`
132-
- Sentry will not be initialised if set to `true`.
132+
- Sentry will not be initialized if set to `true`.
133133
134134
### disableClientSide
135135
@@ -207,22 +207,22 @@ Note that the module sets the following defaults when publishing is enabled:
207207

208208
- Type: `String`
209209
- Default: `source-map`
210-
- Only has effect when `publishRelease = true`
210+
- Only has effect when `publishRelease` is enabled
211211
- The type of source maps generated when publishing release to Sentry. See https://webpack.js.org/configuration/devtool for a list of available options
212212
- **Note**: Consider using `hidden-source-map` instead. For most people, that should be a better option but due to it being a breaking change, it won't be set as the default until next major release
213213
214214
### disableServerRelease
215215
216216
- Type: `Boolean`
217217
- Default: `process.env.SENTRY_DISABLE_SERVER_RELEASE || false`
218-
- Only has effect when `publishRelease = true`
218+
- Only has effect when `publishRelease` is enabled
219219
- See https://docs.sentry.io/workflow/releases for more information
220220
221221
### disableClientRelease
222222
223223
- Type: `Boolean`
224224
- Default: `process.env.SENTRY_DISABLE_CLIENT_RELEASE || false`
225-
- Only has effect when `publishRelease = true`
225+
- Only has effect when `publishRelease` is enabled
226226
- See https://docs.sentry.io/workflow/releases for more information
227227
228228
### clientIntegrations
@@ -238,9 +238,9 @@ Note that the module sets the following defaults when publishing is enabled:
238238
```
239239
- Sentry by default also enables the following browser integrations: `Breadcrumbs`, `Dedupe`, `FunctionToString`, `GlobalHandlers`, `HttpContext`, `InboundFilters`, `LinkedErrors`, `TryCatch`.
240240
- When `tracing` option is enabled then the [Vue Router Instrumentation](https://docs.sentry.io/platforms/javascript/guides/vue/configuration/integrations/vue-router/) is also enabled.
241-
- The full list of client integrations that are supported: `Breadcrumbs`, `CaptureConsole`, `Debug`, `Dedupe`, `ExtraErrorData`, `FunctionToString`, `GlobalHandlers`, `HttpClient`, `HttpContext`, `InboundFilters`, `LinkedErrors`, `ReportingObserver`, `RewriteFrames`, `TryCatch`.
241+
- The full list of client integrations that are supported: `Breadcrumbs`, `CaptureConsole`, `Debug`, `Dedupe`, `ExtraErrorData`, `FunctionToString`, `GlobalHandlers`, `HttpClient`, `HttpContext`, `InboundFilters`, `LinkedErrors`, `Reply`, `ReportingObserver`, `RewriteFrames`, `TryCatch`.
242242
- Integration options can be specified in the object value corresponding to the individual integration key.
243-
- To disable integration that is enabled by default, pass `false` as a value. For example to disable `ExtraErrorData` integration (only), set the option to:
243+
- To disable integration that is enabled by default, pass `false` as a value. For example to disable `ExtraErrorData` integration (only) set the option to:
244244
```js
245245
{
246246
ExtraErrorData: false,
@@ -265,7 +265,7 @@ Note that the module sets the following defaults when publishing is enabled:
265265
- Sentry by default enables the following server integrations: `Console`, `ContextLines`, `Context`, `FunctionToString`, `Http`, `InboundFilters`, `LinkedErrors`, `Modules`,`OnUncaughtException`, `OnUnhandledRejection`, `RequestData`.
266266
- The full list of server integrations that are supported includes the ones above plus: `CaptureConsole`, `Debug`, `Dedupe`, `ExtraErrorData`, `RewriteFrames`, `Transaction`.
267267
- Integration options can be specified in the object value corresponding to the individual integration key.
268-
- To disable integration that is enabled by default, pass `false` as a value. For example to disable `ExtraErrorData` integration (only), set the option to:
268+
- To disable integration that is enabled by default, pass `false` as a value. For example to disable `ExtraErrorData` integration (only) set the option to:
269269
```js
270270
{
271271
Dedupe: {},
@@ -313,7 +313,7 @@ export default function () {
313313
- Type: `Boolean` or `Object`
314314
- Default: `false`
315315
316-
- Enables Sentry Performance Monitoring on the [server](https://docs.sentry.io/platforms/node/performance/) and [browser](https://docs.sentry.io/platforms/javascript/guides/vue/performance/) side.
316+
- Enables Sentry Performance Monitoring on the [server](https://docs.sentry.io/platforms/node/guides/express/performance/) and [browser](https://docs.sentry.io/platforms/javascript/guides/vue/performance/) side.
317317
- Takes the following object configuration format (default values shown):
318318
```js
319319
{
@@ -326,6 +326,8 @@ export default function () {
326326
```
327327
- On the browser side the `BrowserTracing` integration is enabled by default and adds automatic instrumentation for monitoring the performance of the application. The [Vue Router Integration](https://docs.sentry.io/platforms/javascript/guides/vue/configuration/integrations/vue-router/) is also automatically enabled. See all available [`BrowserTracing` options](https://docs.sentry.io/platforms/javascript/guides/vue/performance/instrumentation/automatic-instrumentation/).
328328
- On the browser side extra options for [Tracking Vue components](https://docs.sentry.io/platforms/javascript/guides/vue/features/component-tracking/) can be passed through the `vueOptions` object.
329+
- On the server side the `Http` integration is enabled to trace HTTP requests and [tracingHandler](https://docs.sentry.io/platforms/node/guides/express/performance/) is enabled to trace `connect` and `express` routes.
330+
- See also the [Performance Monitoring](/guide/performance) section for more information.
329331
330332
<alert type="info">
331333
@@ -377,27 +379,8 @@ export default function () {
377379
- Default: `{}`
378380
- Sentry SDK [Basic Browser Options](https://docs.sentry.io/platforms/javascript/guides/vue/configuration/options/).
379381
- The specified keys will override common options set in the `config` key.
380-
- The value can be a string in which case it needs to be a file path (can use [webpack aliases](https://nuxtjs.org/docs/2.x/directory-structure/assets#aliases)) pointing to a javascript file whose default export (a function) returns the configuration object. This is necessary in case some of the options rely on imported values or can't be serialized. The function is passed a `Nuxt Context` argument and can be `async`. Example of how to enable [User Feedback](https://docs.sentry.io/platforms/javascript/enriching-events/user-feedback/) dialog:
381-
```js [nuxt.config.js]
382-
sentry: {
383-
dsn: '...',
384-
clientConfig: '~/config/sentry-client-config.js',
385-
}
386-
```
387-
```js [~/config/sentry-client-config.js]
388-
import { showReportDialog } from '@sentry/vue'
389-
390-
export default function(context) {
391-
return {
392-
beforeSend (event, hint) {
393-
if (event.exception) {
394-
showReportDialog({ eventId: event.event_id })
395-
}
396-
return event
397-
},
398-
}
399-
}
400-
```
382+
- The value can be a string in which case it needs to be a file path (can use [webpack aliases](https://nuxtjs.org/docs/2.x/directory-structure/assets#aliases)) pointing to a javascript file whose default export (a function) returns the configuration object. This is necessary in case some of the options rely on imported values or can't be serialized. The function is passed a `Nuxt Context` argument and can be `async`.
383+
- See an example usage on the [User Feedback](/guide/user-feedback) page.
401384

402385
### requestHandlerConfig
403386

docs/content/en/sentry/runtime-config.md renamed to docs/content/en/configuration/runtime-config.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: Runtime config
33
description: "Load Sentry configuration at runtime"
4-
position: 5
5-
category: Sentry
4+
position: 16
5+
category: Configuration
66
---
77

88
Defining options using the [Nuxt Runtime Config](https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-runtime-config/) functionality allows them to be runtime-based rather than build-time based, as is the case by default.
99

10-
Currently only the `config`, `clientConfig` and `serverConfig` [options](/sentry/options) can be configured using the runtime config.
10+
Currently, only the `config`, `clientConfig` and `serverConfig` [options](/configuration/options) can be configured using the runtime config.
1111

1212
In the Nuxt configuration file define a `publicRuntimeConfig.sentry` configuration object with settings that will be applied at runtime. For example:
1313

@@ -27,6 +27,6 @@ publicRuntimeConfig: {
2727
}
2828
```
2929

30-
You can customize the key that is used to access settings from `publicRuntimeConfig` by setting [`runtimeConfigKey`](/sentry/options#runtimeconfigkey) in the non-runtime options.
30+
You can customize the key that is used to access settings from `publicRuntimeConfig` by setting [`runtimeConfigKey`](/configuration/options#runtimeconfigkey) in the non-runtime options.
3131

3232
This functionality is supported from Nuxt 2.13 and up.

docs/content/en/guide/setup.md renamed to docs/content/en/getting-started/setup.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: Setup
33
description: 'Setup the sentry module into Nuxt'
4-
position: 2
5-
category: Guide
4+
position: 10
5+
category: Getting Started
66
---
77

88
Check the [Nuxt.js documentation](https://nuxtjs.org/guides/configuration-glossary/configuration-modules) for more information about installing and using modules in Nuxt.js.
99

10-
> Nuxt.js v2.4.0+ is required, earlier versions are not supported
10+
> Nuxt.js v2.16.0+ is required, earlier versions are not supported.
1111
1212
## Installation
1313

@@ -44,7 +44,7 @@ Then, add `@nuxtjs/sentry` to the `modules` section of `nuxt.config.js` and set
4444
}
4545
```
4646

47-
See [Options](/sentry/options) for a list of available options.
47+
See [Options](/configuration/options) for a list of available options.
4848

4949
Note that the Sentry SDK dependencies (`@sentry/*`) are not pinned and can be updated independently from the module itself by running `npm upgrade @nuxtjs/sentry` or `yarn upgrade @nuxtjs/sentry`. That means you don't have to wait for a new module release if you want to update to the latest SDK version.
5050

@@ -67,6 +67,6 @@ In Typescript or type-checked JavaScript projects, add `@nuxtjs/sentry` to the `
6767

6868
The otherwise optional package `@sentry/webpack-plugin` has to be installed for types to be fully working.
6969

70-
If not using the relevant functionality (`tracing` and `publishRelease` options are not enabled) then those packages can be installed as dev-only dependencies.
70+
If not using the relevant functionality (`publishRelease` option is not enabled) then this package can be installed as dev-only dependency.
7171

7272
</alert>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: Enriching Events
3+
description: Enriching Reported Events
4+
position: 21
5+
category: Guide
6+
---
7+
8+
Sentry SDK provides API for enhancing events that are being reported. For example, you can:
9+
- set user information like IP address or username using `Sentry.setUser` API
10+
- add custom structured data using `Sentry.setContext` API
11+
- set custom key/value pairs (tags) that get indexed and can be used for filtering and searching using `Sentry.setTag` API
12+
- add file attachments using `scope.addAttachment` API
13+
- manually add breadcrumbs using `Sentry.addBreadcrumb` API
14+
- and other...
15+
16+
Read more about [Enriching Events](https://docs.sentry.io/platforms/javascript/guides/vue/enriching-events/).

docs/content/en/sentry/lazy-loading.md renamed to docs/content/en/guide/lazy-loading.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: Lazy-Loading (client-side)
3-
description: 'Load Sentry module lazily on the client'
4-
position: 6
5-
category: Sentry
3+
description: Load Sentry module lazily on the client
4+
position: 22
5+
category: Guide
66
---
77

88
Set `lazy: true` in your module options to load Sentry lazily on the client. This will prevent Sentry from being included in your main bundle and should result in a faster initial page load.
99

10-
You can also pass a lazy config object in your module options (see [options](/sentry/options#lazy) for more information).
10+
You can also pass a lazy config object in your module options (see [options](/configuration/options#lazy) for more information).
1111

1212
<alert type="info">
1313

@@ -22,7 +22,7 @@ You can also pass a lazy config object in your module options (see [options](/se
2222

2323
Normally `$sentry` would always refer to the `@sentry/vue` API. But if we lazy load Sentry this API wont be available until Sentry has loaded. If you don't want to worry about whether Sentry is loaded or not, a mocked Sentry API is injected into the Nuxt.js context that will execute all Sentry API calls once Sentry is loaded
2424

25-
See: [`injectMock`](/sentry/options#lazy) and [`mockApiMethods`](/sentry/options#lazy) options.
25+
See: [`injectMock`](/configuration/options#lazy) and [`mockApiMethods`](/configuration/options#lazy) options.
2626

2727
#### `$sentryReady`
2828
- Type `Function`

docs/content/en/guide/migration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Migration guide
33
description: Follow this guide to upgrade from one major version to the other.
4-
position: 10
4+
position: 29
55
category: Guide
66
---
77

docs/content/en/guide/performance.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: Performance Monitoring
3+
description: Track performance metrics
4+
position: 23
5+
category: Guide
6+
---
7+
8+
To automatically configure and enable performance monitoring, enable the [tracing](/configuration/options#tracing) option.
9+
10+
This enables various additional integrations for monitoring and instrumentation. On the client-side it enables [`BrowserTracing`](https://docs.sentry.io/platforms/javascript/guides/vue/performance/instrumentation/automatic-instrumentation/) and [`Vue Router Instrumentation`](https://docs.sentry.io/platforms/javascript/guides/vue/configuration/integrations/vue-router/) integrations. On the server-side it enables the [`Http` and `tracingHandler`](https://docs.sentry.io/platforms/node/guides/express/performance/instrumentation/automatic-instrumentation/) integrations for tracing HTTP requests and `connect`/`express` routes.
11+
12+
See the description of the [tracing](/configuration/options#tracing) option if you want to customize some aspect of that functionality like the percentage of requests to capture.
13+
14+
<alert type="info">
15+
16+
Note that the `tracesSampleRate` value can be between 0.0 and 1.0 (percentage of requests to capture) and Sentry documentation strongly recommends reducing the value from the default 1.0.
17+
18+
</alert>
19+
20+
See also Sentry's SDK [client](https://docs.sentry.io/platforms/javascript/guides/vue/performance/) and [server](https://docs.sentry.io/platforms/node/guides/express/performance/) Performance Monitoring pages for additional information about those integrations.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: Session Replay
3+
description: Record and replay user interactions that lead to an error
4+
position: 24
5+
category: Guide
6+
---
7+
8+
Session Replay helps you get to the root cause of an error or latency issue faster by providing you with a video-like reproduction of what was happening in the user's browser before, during, and after the issue.
9+
10+
### Setup
11+
12+
Session Replay comes as a separate integration that is not enabled by default. To enable it, add `Replay: {}` to the [`clientIntegrations`](/configuration/options#clientintegrations) option like so:
13+
14+
```js [nuxt.config.js]
15+
sentry: {
16+
dsn: '...',
17+
clientIntegrations: [
18+
Reply: {},
19+
],
20+
clientConfig: {
21+
// This sets the sample rate to be 10%. You may want this to be 100% while
22+
// in development and sample at a lower rate in production
23+
replaysSessionSampleRate: 0.1,
24+
// If the entire session is not sampled, use the below sample rate to sample
25+
// sessions when an error occurs.
26+
replaysOnErrorSampleRate: 1.0,
27+
}
28+
}
29+
```
30+
31+
You can customize integration options by passing them within the `{}` object.
32+
33+
<alert type="info">
34+
35+
Note that the `replaysSessionSampleRate` and `replaysOnErrorSampleRate` options are part of the global client options and not options of the `Replay` integration itself.
36+
37+
</alert>
38+
39+
<alert type="info">
40+
41+
Refer to the Sentry documentation below to make sure that Content Security Policy (CSP) is configured properly for allowing `Replay` integration to do its work.
42+
43+
</alert>
44+
45+
### Documentation
46+
47+
See Sentry's [Session Replay](https://docs.sentry.io/platforms/javascript/guides/vue/session-replay/) pages for additional information.

docs/content/en/guide/usage.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
11
---
22
title: Usage / API
3-
description: 'Usage of Sentry in Nuxt'
4-
position: 3
3+
description: Usage of Sentry in Nuxt
4+
position: 20
55
category: Guide
66
---
77

88
### Automatic Capturing
99

1010
Once enabled, Sentry automatically reports errors, uncaught exceptions and unhandled rejections. No need for further steps, unless you like to report (certain) exceptions manually or have deactivated integrations like `GlobalError`. In this case, find out below how to send reports manually.
1111

12-
### Enriching Reported Events
13-
14-
Sentry SDK provides API for enhancing events that are being reported. For example, you can:
15-
- set user information like IP address or username using `Sentry.setUser` API
16-
- add custom structured data using `Sentry.setContext` API
17-
- set custom key/value pairs (tags) that get indexed and can be used for filtering and searching using `Sentry.setTag` API
18-
- add file attachments using `scope.addAttachment` API
19-
- manually add breadcrumbs using `Sentry.addBreadcrumb` API
20-
- and other...
21-
22-
Read more about [Enriching Events](https://docs.sentry.io/platforms/javascript/guides/vue/enriching-events/).
23-
2412
### Usage in Vue components
2513

2614
In a Vue component, `Sentry` is available as `this.$sentry`, so we can call functions like
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: User Feedback
3+
description: A feedback dialog for providing additional user information
4+
position: 25
5+
category: Guide
6+
---
7+
8+
When a user experiences an error, Sentry provides the ability to collect additional feedback through a feedback dialog.
9+
10+
### Setup
11+
12+
`showReportDialog` is a function that should be called to trigger the User Feedback dialog. Due to how Nuxt works, we can't reference it directly from within Nuxt config as Sentry configuration is strinigified and the function reference does not survive that. We have to use the `clientConfig` option with a path to a custom client configuration that imports the function like so:
13+
14+
```js [nuxt.config.js]
15+
sentry: {
16+
dsn: '...',
17+
clientConfig: '~/config/sentry-client-config.js',
18+
}
19+
```
20+
21+
```js [~/config/sentry-client-config.js]
22+
import { showReportDialog } from '@sentry/vue'
23+
24+
export default function(context) {
25+
return {
26+
beforeSend (event, hint) {
27+
if (event.exception) {
28+
showReportDialog({ eventId: event.event_id })
29+
}
30+
return event
31+
},
32+
}
33+
}
34+
```
35+
36+
<alert type="info">
37+
38+
The configuration provided through `clientConfig` is merged with the configuration provided in the Nuxt config so other configuration options can (but don't have to) be defined in Nuxt config.
39+
40+
</alert>
41+
42+
### Documentation
43+
44+
See Sentry's [User Feedback](https://docs.sentry.io/platforms/javascript/guides/vue/enriching-events/user-feedback/) pages for additional information.

0 commit comments

Comments
 (0)