From 9835fbf694eb91f0fde702bed3de08203be176b5 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Thu, 27 Feb 2025 16:11:55 +0100 Subject: [PATCH] fix: change Sentry ANR threshold to 10 seconds (#1542) Closes #1495, #1497, #1502, #1507, #1516, #1523, #1530 --- sentry.server.config.ts | 1 + src/config/interfaces/SentryConfig.ts | 1 + src/config/loadServerConfig.ts | 2 ++ 3 files changed, 4 insertions(+) diff --git a/sentry.server.config.ts b/sentry.server.config.ts index 519bc90d..ceec6cfc 100644 --- a/sentry.server.config.ts +++ b/sentry.server.config.ts @@ -14,6 +14,7 @@ Sentry.init({ integrations: [ Sentry.anrIntegration({ + anrThreshold: sentryConfig.anrThreshold, captureStackTrace: true, }), Sentry.extraErrorDataIntegration(), diff --git a/src/config/interfaces/SentryConfig.ts b/src/config/interfaces/SentryConfig.ts index 9ee8fe55..a8abf8ba 100644 --- a/src/config/interfaces/SentryConfig.ts +++ b/src/config/interfaces/SentryConfig.ts @@ -10,4 +10,5 @@ export interface SentryConfig { sampleRate?: number; profilesSampleRate?: number; tracesSampleRate?: number; + anrThreshold?: number; } diff --git a/src/config/loadServerConfig.ts b/src/config/loadServerConfig.ts index 212b84e9..f2581f49 100644 --- a/src/config/loadServerConfig.ts +++ b/src/config/loadServerConfig.ts @@ -110,6 +110,8 @@ export function loadServerConfig(): ServerConfig { sampleRate: parseNumberEnvValue(env.SENTRY_SAMPLE_RATE), profilesSampleRate: parseNumberEnvValue(env.SENTRY_PROFILES_SAMPLE_RATE), tracesSampleRate: parseNumberEnvValue(env.SENTRY_TRACES_SAMPLE_RATE), + // Increased the default threshold to 10 seconds, due to slow startup times on Kubernetes + anrThreshold: parseNumberEnvValue(env.SENTRY_ANR_THRESHOLD) ?? 10_000, }, }; return config;