Skip to content

Commit 8f8e032

Browse files
authored
refactor/OPS-353 : 분리 완료. (#87)
1 parent 21834c4 commit 8f8e032

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.tuna.zoopzoop.backend.global.config.sentry;
2+
3+
import org.springframework.core.env.Environment;
4+
import org.springframework.stereotype.Component;
5+
6+
@Component
7+
public class ProfileChecker {
8+
private final Environment environment;
9+
10+
public ProfileChecker(Environment environment) {
11+
this.environment = environment;
12+
}
13+
14+
public String[] getActiveProfiles() {
15+
return environment.getActiveProfiles();
16+
}
17+
}
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
package org.tuna.zoopzoop.backend.global.config.sentry;
22

33
import io.sentry.SentryOptions;
4+
import lombok.RequiredArgsConstructor;
5+
import lombok.extern.slf4j.Slf4j;
46
import org.springframework.context.annotation.Bean;
57
import org.springframework.context.annotation.Configuration;
68

79
@Configuration
10+
@RequiredArgsConstructor
11+
@Slf4j
812
public class SentryConfig {
13+
private final ProfileChecker profileChecker;
914

1015
@Bean
1116
public SentryOptions.BeforeSendCallback beforeSend() {
1217
return (event, hint) -> {
18+
log.info("[Sentry] 현재 프로필: {}", profileChecker.getActiveProfiles()[0]);
19+
if("test".equals(profileChecker.getActiveProfiles()[0])) return null;
20+
log.info("[Sentry] 정상 통과됨.");
1321
if(event.getMessage() != null
1422
&& event.getMessage().getFormatted().contains("JWT 토큰")) {
1523
return null;
1624
}
1725
return event;
1826
};
1927
}
20-
}
28+
}

0 commit comments

Comments
 (0)