From 1d1d4af5725522a9211257ea3512fa581837e5b9 Mon Sep 17 00:00:00 2001 From: jangwoong Date: Mon, 20 Jul 2026 09:33:50 +0900 Subject: [PATCH] =?UTF-8?q?[as]=20Sentry=20Replay=20integration=EC=97=90?= =?UTF-8?q?=20=EB=84=A4=ED=8A=B8=EC=9B=8C=ED=81=AC=20=EC=83=81=EC=84=B8=20?= =?UTF-8?q?=EB=A1=9C=EA=B9=85=20=ED=95=84=ED=84=B0=20=EB=B0=8F=20=ED=97=A4?= =?UTF-8?q?=EB=8D=94=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/as/instrumentation-client.ts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/apps/as/instrumentation-client.ts b/apps/as/instrumentation-client.ts index 93548aca2..53f6d9761 100644 --- a/apps/as/instrumentation-client.ts +++ b/apps/as/instrumentation-client.ts @@ -7,6 +7,18 @@ const isSentryEnabled = process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "dev" && process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT !== "prd"; +const getSentryHost = (dsn?: string) => { + if (!dsn) return null; + try { + const url = new URL(dsn); + return url.host; + } catch { + return null; + } +}; + +const sentryHost = getSentryHost(process.env.NEXT_PUBLIC_SENTRY_DSN); + Sentry.init({ enabled: isSentryEnabled, dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, @@ -14,6 +26,18 @@ Sentry.init({ tracesSampleRate: 1.0, replaysSessionSampleRate: 1.0, replaysOnErrorSampleRate: 1.0, - integrations: [Sentry.replayIntegration()], + integrations: [ + Sentry.replayIntegration({ + networkDetailAllowUrls: sentryHost + ? [ + new RegExp( + `^(?!.*${sentryHost.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}).*(?:/api/|/server/).*$`, + ), + ] + : [/\/(?:api|server)\//], + networkRequestHeaders: ["X-Custom-Header"], + networkResponseHeaders: ["X-Custom-Header"], + }), + ], debug: process.env.NEXT_PUBLIC_SENTRY_DEBUG === "true", });