-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsentry.client.config.ts
36 lines (28 loc) · 1.04 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
import { loadClientConfig } from "@/config/loadClientConfig";
import * as Sentry from "@sentry/nextjs";
async function initSentry() {
const config = loadClientConfig();
const sentryConfig = config.sentryConfig;
console.log("Initializing Sentry on client, using DSN:", sentryConfig.dsn);
if (!sentryConfig.enabled) {
console.warn("⚠️ WARNING: SENTRY IS NOT ENABLED! ⚠️");
}
Sentry.init({
enabled: sentryConfig.enabled,
dsn: sentryConfig.dsn,
debug: sentryConfig.debug,
release: sentryConfig.release,
replaysOnErrorSampleRate: sentryConfig.replaysOnErrorSampleRate,
replaysSessionSampleRate: sentryConfig.replaysSessionSampleRate,
integrations: [Sentry.replayIntegration()],
tracesSampler: (samplingContext) => {
// Ignore the health endpoint from trace sampling
if (samplingContext.transactionContext.name == "GET /api/health") {
return false;
}
return sentryConfig.tracesSampleRate ?? 0.2;
},
sampleRate: sentryConfig.sampleRate,
});
}
void initSentry();