feat: 예외 로그 누락 보완 및 Slack 에러 알림 개선 - #483
Merged
Merged
Conversation
📊 테스트 커버리지 리포트
|
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.
#️⃣ Issue Number
📝 요약(Summary)
@Valid실패, JSON 파싱 실패, 응답 직렬화 실패는ControllerLogAspect밖에서 발생해 아무 로그도 남지 않았습니다.spring.mvc.log-resolved-exception: true를 추가했습니다.@ExceptionHandler가 처리한 예외가 스택트레이스 없이Resolved [...]WARN 한 줄로 남습니다.MDCLoggingFilter에서 MDC에uri(예:POST /v2/reviews)를 넣도록 했습니다. JSON 파일 로그의 모든 줄에uri필드가 붙습니다.SlackService.sendSlackMessage에@Async를 붙였습니다. 메시지는 요청 스레드에서 먼저 만들어지므로 Grafana 링크의requestId는 그대로 유지됩니다.AsyncConfig에 MDC를 복사하는TaskDecorator빈을 추가했습니다.@Async로 도는LogEventListener의 비즈니스 로그와 Slack 전송 로그에도requestId와uri가 붙습니다.|= "reqId=<id>"가 아무 로그도 찾지 못하고 있었습니다.|= "<id>"로 수정했습니다.X-Request-ID응답 헤더 반환 + 형식 검증X-Request-ID를 넣습니다. 앱에서 에러를 문의할 때 이 값으로 서버 로그를 바로 찾을 수 있습니다.X-RequestID에서X-Request-ID로 바꿨습니다.Asia/Seoul을 지정했습니다. JVM 시간대는 바꾸지 않았습니다.GlobalExceptionHandler미사용 코드 제거SlackErrorNotifier,serverEnv,@Slf4j를 제거했습니다. 생성자가 바뀌어서 이를 사용하던 테스트 9개 파일도 함께 수정했습니다.💬 공유사항 to 리뷰어
X-RequestID→X-Request-ID).X-Request-ID값을 같이 전달해 달라"고 공유할 예정입니다.spring.task.execution.pool.queue-capacity로 상한을 두면 됩니다.EXCEPTIONERROR 로그와ResolvedWARN이 둘 다 남습니다. 같은requestId로 묶이는 한 줄짜리라서 감수하기로 했습니다.MDCLoggingFilterTest(uri, 응답 헤더, 형식 검증),AsyncConfigTest(MDC 전파와 정리),SlackMessageFormatTest(링크 쿼리)입니다.@Async실행기가 Boot 기본값(applicationTaskExecutor) 하나뿐이고, 여기에 decorator가 적용된다는 것도 임시 테스트로 확인했습니다.log-resolved-exception은 prod/dev 프로필에만 켜져 있어서 테스트로 검증되지 않습니다.{service_name="eatssu-dev"} | json | level="WARN"으로 조회해서Resolved로그에uri가 붙는지 확인합니다.X-Request-ID가 있는지 확인합니다.LocalDateTime.now()로 DB에 저장되는 신고 시각 등이 UTC일 수 있습니다. 로그와는 별개라 이번 PR에서는 다루지 않았습니다.✅ PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.
🤖 Generated with Claude Code