-
Notifications
You must be signed in to change notification settings - Fork 1
/
sentry.client.config.ts
51 lines (39 loc) · 1.55 KB
/
sentry.client.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// This file configures the initialization of Sentry on the client.
// The config you add here will be used whenever a users loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from "@sentry/nextjs";
import { websiteConfig } from '@/lib/data'
// proportion of traces to send to Sentry
const TRACES_SAMPLE_RATE = 1.0
if (process.env.NODE_ENV === 'production') {
Sentry.init({
dsn: websiteConfig.sentry_dsn,
tracesSampler({ location }) {
// Not sure what traces don't have a location, but sample them just in case.
if (!location) {
return TRACES_SAMPLE_RATE;
}
// Only send traces to Sentry if the user is on the production domain
if (!location.host.endsWith('watonomous.ca')) {
return 0.0
}
// Do not send traces to Sentry if the user is in the preview environment
if (location.host === 'rgw-preview.watonomous.ca') {
return 0.0
}
return TRACES_SAMPLE_RATE;
},
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
// TODO: reduce session sample rate in production if needed
replaysSessionSampleRate: 1.0,
replaysOnErrorSampleRate: 1.0,
tunnel: websiteConfig.sentry_tunnel,
integrations: [],
});
// Lazy-load the Sentry Replay integration
// https://docs.sentry.io/platforms/javascript/session-replay/#lazy-loading-replay
import('@sentry/browser').then(({ Replay }) => {
Sentry.addIntegration(new Replay());
})
}