-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsentry.client.config.ts
43 lines (39 loc) · 1.37 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
// This file configures the initialization of Sentry on the browser.
// The config you add here will be used whenever a page is visited.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from "@sentry/nextjs";
import { env } from "@/env.mjs";
import { getVersion } from "@/modules/serverUtils";
const { SENTRY_ENVIRONMENT } = env;
const VERSION = getVersion();
const APP_NAME = "tilavarauspalvelu-ui";
const isBrowser = typeof window !== "undefined";
const config = {
tracesSampleRate: 0.2,
debug: false,
release: `${APP_NAME}@${VERSION}`,
integrations: isBrowser ? [Sentry.replayIntegration()] : [],
// Define how likely Replay events are sampled.
// 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,
// Define how likely Replay events are sampled when an error occurs.
replaysOnErrorSampleRate: 1.0,
};
Sentry.init({
...config,
dsn: "",
environment: SENTRY_ENVIRONMENT,
});
/// updateSentryConfig
/// @param dsn string
/// @param environment string
/// @returns void
/// @description Since client has no access to env variables (outside of build time), we need to set the dns during runtime.
export function updateSentryConfig(dsn: string, environment: string) {
Sentry.init({
...config,
dsn,
environment,
});
}