|
1 | 1 | import * as Sentry from "@sentry/nextjs"; |
2 | 2 |
|
3 | | -Sentry.init({ |
4 | | - dsn: process.env.SENTRY_DSN || "", |
5 | | - environment: process.env.SENTRY_ENVIRONMENT || "development", |
| 3 | +// 프로덕션 환경에서만 Sentry 초기화 |
| 4 | +if (process.env.NODE_ENV === "production") { |
| 5 | + Sentry.init({ |
| 6 | + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN || process.env.SENTRY_DSN || "", |
| 7 | + environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT || process.env.SENTRY_ENVIRONMENT || "production", |
6 | 8 |
|
7 | | - // Performance Monitoring: 모든 트랜잭션 샘플링 (프로덕션에서는 0.1~0.3 권장) |
8 | | - tracesSampleRate: 1.0, |
| 9 | + // Adds request headers and IP for users |
| 10 | + // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii |
| 11 | + sendDefaultPii: true, |
9 | 12 |
|
10 | | - // Replay 샘플링 설정 |
11 | | - replaysSessionSampleRate: 0.1, // 일반 세션의 10% |
12 | | - replaysOnErrorSampleRate: 1.0, // 에러 발생 시 100% |
| 13 | + // Performance Monitoring: 프로덕션에서 30% 샘플링 |
| 14 | + // https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate |
| 15 | + tracesSampleRate: 0.3, |
13 | 16 |
|
14 | | - integrations: [ |
15 | | - // Browser Tracing: 페이지 로드 및 네비게이션 성능 측정 |
16 | | - Sentry.browserTracingIntegration({ |
17 | | - tracePropagationTargets: [ |
18 | | - "localhost", |
19 | | - "solid-connection.com", |
20 | | - "solid-connect-web", |
21 | | - "solid-connect", |
22 | | - /^https:\/\/(www\.)?solid[\-]?connection\.com/, |
23 | | - ], |
24 | | - // Web Vitals 자동 수집 활성화 |
25 | | - enableInp: true, // Interaction to Next Paint (INP) 측정 |
26 | | - }), |
| 17 | + // Session Replay 샘플링 설정 |
| 18 | + // Capture Replay for 10% of all sessions, plus 100% of sessions with an error |
| 19 | + // https://docs.sentry.io/platforms/javascript/session-replay/configuration/#general-integration-configuration |
| 20 | + replaysSessionSampleRate: 0.1, // 일반 세션의 10% |
| 21 | + replaysOnErrorSampleRate: 1.0, // 에러 발생 시 100% |
27 | 22 |
|
28 | | - // Session Replay: 사용자 세션 녹화 |
29 | | - Sentry.replayIntegration({ |
30 | | - maskAllText: true, |
31 | | - blockAllMedia: true, |
32 | | - }), |
33 | | - ], |
34 | | -}); |
| 23 | + integrations: [ |
| 24 | + // Browser Tracing: 페이지 로드 및 네비게이션 성능 측정 |
| 25 | + Sentry.browserTracingIntegration({ |
| 26 | + tracePropagationTargets: ["solid-connection.com", /^https:\/\/(www\.)?solid[\-]?connection\.com/], |
| 27 | + // Web Vitals 자동 수집 활성화 |
| 28 | + enableInp: true, // Interaction to Next Paint (INP) 측정 |
| 29 | + }), |
| 30 | + |
| 31 | + // Session Replay: 사용자 세션 녹화 (클라이언트 전용) |
| 32 | + Sentry.replayIntegration({ |
| 33 | + maskAllText: true, |
| 34 | + blockAllMedia: true, |
| 35 | + }), |
| 36 | + ], |
| 37 | + }); |
| 38 | +} |
0 commit comments