fix: SentryExceptionResolver 실행 순서를 LOWEST_PRECEDENCE로 조정하여 AuthException Sentry 오탐 방지#46
Draft
Jeongho0805 wants to merge 1 commit into
Draft
fix: SentryExceptionResolver 실행 순서를 LOWEST_PRECEDENCE로 조정하여 AuthException Sentry 오탐 방지#46Jeongho0805 wants to merge 1 commit into
Jeongho0805 wants to merge 1 commit into
Conversation
…tion Sentry 오탐 방지
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 사항
application.yml에sentry.exception-resolver-order: 2147483647(Ordered.LOWEST_PRECEDENCE) 설정 추가배경
Sentry 이슈 PRACTICKET-62 (
AuthException: 토큰이 존재하지 않습니다.)가 프로덕션 환경에서 캡처되고 있음.AuthException은GlobalException을 상속하며,GlobalExceptionHandler.handleGlobalException()이 이를 올바르게 처리해 HTTP 404를 반환하고Sentry.captureException()을 호출하지 않음. 그러나sentry-spring-boot-starter가 자동 등록하는SentryExceptionResolver가 기본적으로HIGHEST_PRECEDENCE순서로 등록되어, Spring의ExceptionHandlerExceptionResolver보다 먼저 실행됨. 이로 인해 예상된 클라이언트 인증 오류(AuthException)가 Sentry에 오탐으로 수집되는 문제가 발생함.exception-resolver-order를LOWEST_PRECEDENCE로 설정하면 Spring의@RestControllerAdvice가 먼저 예외를 처리하고,SentryExceptionResolver는 미처리 예외에 대해서만 동작함. 실제 서버 오류는GlobalExceptionHandler.handle(Exception.class)내의 명시적Sentry.captureException(e)호출을 통해 계속 Sentry에 전달됨.