Skip to content

Commit c6e207f

Browse files
authored
Merge pull request #293 from manNomi/init/centry
Init/centry
2 parents cb905ec + f032f95 commit c6e207f

3 files changed

Lines changed: 59 additions & 46 deletions

File tree

sentry.client.config.ts

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
import * as Sentry from "@sentry/nextjs";
22

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",
68

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,
912

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,
1316

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%
2722

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+
}

sentry.edge.config.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
55
import * as Sentry from "@sentry/nextjs";
66

7-
Sentry.init({
8-
dsn: process.env.SENTRY_DSN || "",
9-
environment: process.env.SENTRY_ENVIRONMENT || "development",
7+
// 프로덕션 환경에서만 Sentry 초기화
8+
if (process.env.NODE_ENV === "production") {
9+
Sentry.init({
10+
dsn: process.env.SENTRY_DSN || "",
11+
environment: process.env.SENTRY_ENVIRONMENT || "production",
1012

11-
// Adjust this value in production, or use tracesSampler for greater control
12-
tracesSampleRate: 1,
13+
// Performance Monitoring: 프로덕션에서 30% 샘플링
14+
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
15+
tracesSampleRate: 0.3,
1316

14-
// Setting this option to true will print useful information to the console while you're setting up Sentry.
15-
debug: false,
16-
});
17+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
18+
debug: false,
19+
});
20+
}

sentry.server.config.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@
33
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
44
import * as Sentry from "@sentry/nextjs";
55

6-
Sentry.init({
7-
dsn: process.env.SENTRY_DSN || "",
8-
environment: process.env.SENTRY_ENVIRONMENT || "development",
6+
// 프로덕션 환경에서만 Sentry 초기화
7+
if (process.env.NODE_ENV === "production") {
8+
Sentry.init({
9+
dsn: process.env.SENTRY_DSN || "",
10+
environment: process.env.SENTRY_ENVIRONMENT || "production",
911

10-
// Adjust this value in production, or use tracesSampler for greater control
11-
tracesSampleRate: 1,
12+
// Adds request headers and IP for users
13+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
14+
sendDefaultPii: true,
1215

13-
// Setting this option to true will print useful information to the console while you're setting up Sentry.
14-
debug: false,
16+
// Performance Monitoring: 프로덕션에서 30% 샘플링
17+
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
18+
tracesSampleRate: 0.3,
1519

16-
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
17-
// spotlight: process.env.NODE_ENV === 'development',
18-
});
20+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
21+
debug: false,
22+
});
23+
}

0 commit comments

Comments
 (0)