Skip to content

Commit c78b000

Browse files
authored
Merge pull request #316 from prgrms-web-devcourse-final-project/chore/33-infra
chore[initdate]: sentry test
2 parents c8552b0 + 241f31e commit c78b000

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.ai.lawyer.global.sentry;
2+
3+
import io.sentry.Sentry;
4+
import io.sentry.SentryOptions;
5+
import jakarta.annotation.PostConstruct;
6+
import lombok.extern.slf4j.Slf4j;
7+
import org.springframework.beans.factory.annotation.Value;
8+
import org.springframework.context.annotation.Configuration;
9+
10+
@Slf4j
11+
@Configuration
12+
public class SentryManualConfig {
13+
14+
@Value("${sentry.dsn:}")
15+
private String sentryDsn;
16+
17+
@Value("${sentry.environment:prod}")
18+
private String environment;
19+
20+
@Value("${sentry.release:unknown}")
21+
private String release;
22+
23+
@PostConstruct
24+
public void init() {
25+
if (sentryDsn == null || sentryDsn.isBlank()) {
26+
log.warn("Sentry DSN not set — skipping Sentry init.");
27+
return;
28+
}
29+
30+
Sentry.init(options -> {
31+
options.setDsn(sentryDsn);
32+
options.setEnvironment(environment);
33+
options.setRelease(release);
34+
options.setSendDefaultPii(true);
35+
options.setEnableExternalConfiguration(true);
36+
options.setTracesSampleRate(1.0); // 100% 트레이스 수집
37+
log.info("Sentry manually initialized (forcing enable)");
38+
});
39+
}
40+
}

backend/src/main/java/com/ai/lawyer/global/test/SentryTestController.java renamed to backend/src/main/java/com/ai/lawyer/global/sentry/SentryTestController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.ai.lawyer.global.test;
1+
package com.ai.lawyer.global.sentry;
22

33
import io.sentry.Sentry;
44
import org.springframework.web.bind.annotation.GetMapping;

0 commit comments

Comments
 (0)