-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7bfaf24
commit fce4f85
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
src/platform-includes/session-replay/install/javascript.gatsby.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The Replay integration is **already included** with the Gatsby SDK package. | ||
|
||
```bash {tabTitle: npm} | ||
npm install --save @sentry/gatsby | ||
``` | ||
|
||
```bash {tabTitle: Yarn} | ||
yarn add @sentry/gatsby | ||
``` |
45 changes: 45 additions & 0 deletions
45
src/platform-includes/session-replay/setup/javascript.gatsby.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
```javascript | ||
import * as Sentry from "@sentry/gatsby"; | ||
|
||
Sentry.init({ | ||
dsn: "___PUBLIC_DSN___", | ||
|
||
// This sets the sample rate to be 10%. You may want this to be 100% while | ||
// in development and sample at a lower rate in production | ||
replaysSessionSampleRate: 0.1, | ||
|
||
// If the entire session is not sampled, use the below sample rate to sample | ||
// sessions when an error occurs. | ||
replaysOnErrorSampleRate: 1.0, | ||
|
||
integrations: [ | ||
new Sentry.Replay({ | ||
// Additional SDK configuration goes in here, for example: | ||
maskAllText: true, | ||
blockAllMedia: true, | ||
}), | ||
], | ||
}); | ||
``` | ||
|
||
With the settings above, session replays with errors are always captured. | ||
You can verify that with the following: | ||
|
||
```javascript | ||
myUndefinedFunction(); | ||
``` | ||
|
||
### Lazy-loading Replay | ||
|
||
Once you've added the integration, Replay will start automatically. If you don't want to start it immediately (lazy-load it), you can use `addIntegration`: | ||
|
||
```js | ||
Sentry.init({ | ||
// Note, Replay is NOT instantiated below: | ||
integrations: [], | ||
}); | ||
|
||
// Sometime later | ||
const { getCurrentHub, Replay } = await import("@sentry/gatsby"); | ||
getCurrentHub().getClient().addIntegration(new Replay()); | ||
``` |