-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstrumentation-client.ts
More file actions
41 lines (29 loc) · 1.53 KB
/
Copy pathinstrumentation-client.ts
File metadata and controls
41 lines (29 loc) · 1.53 KB
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
// This file configures the initialization of Sentry on the client.
// The added config 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';
const isProduction = process.env.NODE_ENV === 'production';
const sentryEnabled = isProduction;
if (sentryEnabled && process.env.NEXT_PUBLIC_SENTRY_DSN) {
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
// Disable Sentry in development
enabled: isProduction,
// Add optional integrations for additional features (тільки у production)
integrations: isProduction ? [Sentry.replayIntegration()] : [],
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
tracesSampleRate: isProduction ? 0.1 : 0,
// Enable logs to be sent to Sentry (тільки у production)
enableLogs: isProduction,
// Define how likely Replay events are sampled (only in production)
replaysSessionSampleRate: isProduction ? 0 : 0,
// Define how likely Replay events are sampled when an error occurs
replaysOnErrorSampleRate: isProduction ? 1.0 : 0,
// Disable sending user PII for privacy
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
sendDefaultPii: false,
// Configuration for production environment
environment: process.env.NODE_ENV,
});
}
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;