Skip to content

Commit

Permalink
[feat][#74] businessException은 필터링
Browse files Browse the repository at this point in the history
  • Loading branch information
sejoon00 committed Aug 24, 2024
1 parent b7cfe7f commit c06ed9e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.server.bbo_gak.global.config.sentry;

import com.server.bbo_gak.global.error.exception.BusinessException;
import io.sentry.Sentry;
import io.sentry.SentryOptions;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SentryConfig {

@Value("${sentry.dsn}")
private String dsn;

@Bean
public Sentry.OptionsConfiguration<SentryOptions> sentryOptions() {
return options -> {
options.setDsn(dsn);

options.setBeforeSend((event, hint) -> {
// 특정 예외 필터링 로직
if (event.getThrowable() != null && event.getThrowable() instanceof BusinessException) {
return null; // 이 이벤트는 Sentry로 전송되지 않음
}
return event; // 필터링하지 않을 경우, 이벤트 반환
});
};
}
}
7 changes: 6 additions & 1 deletion src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ google:
scheduler:
thread:
pool:
size: 2
size: 2

sentry:
dsn: https://b0e61ee9ddb2c12240759111df8b607c@o4505869811908608.ingest.us.sentry.io/4507831077240832
exception-resolver-order: -2147483647
tracesSampleRate: 1.0

0 comments on commit c06ed9e

Please sign in to comment.