Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YS-155] refact: 예외 핸들링 로직 수정 및 500 에러 디스코드 웹훅 알림 추가 #37

Merged
merged 6 commits into from
Jan 17, 2025

Conversation

Ji-soo708
Copy link
Member

@Ji-soo708 Ji-soo708 commented Jan 17, 2025

💡 작업 내용

  • 핸들링되지 않은 예외에 대해 INTERNAL_SERVER_ERROR(500)가 나도록 수정
  • 핸들링되지 않은 예외가 발생할 경우, 디스코드 에러 알림이 가도록 기능 구현

로컬에서 테스트했을 때
image

✅ 셀프 체크리스트

  • PR 제목을 형식에 맞게 작성했나요?
  • 브랜치 전략에 맞는 브랜치에 PR을 올리고 있나요?
  • 테스트는 잘 통과했나요?
  • 빌드에 성공했나요?
  • 본인을 assign 해주세요.
  • 해당 PR에 맞는 label을 붙여주세요.

🙋🏻‍ 확인해주세요

  • 500 Internal Server Error 처리 로직을 개선하고, 핸들링되지 않은 예외 발생 시 디스코드 웹훅 알림을 통해 실시간으로 디스코드에 알림을 보낼 수 있도록 추가했습니다
  • 실제 디스코드 웹훅 URL은 개발/운영 서버에만 추가합니다. 로컬에서는 임의의 값을 넣어주세요.

🔗 Jira 티켓


https://yappsocks.atlassian.net/browse/YS-155

@Ji-soo708 Ji-soo708 added ♻️ REFACTORING 리팩토링 ✨ FEATURE 기능 추가 labels Jan 17, 2025
@Ji-soo708 Ji-soo708 self-assigned this Jan 17, 2025
@github-actions github-actions bot changed the title refact: 예외 핸들링 로직 수정 및 500 에러 디스코드 웹훅 알림 추가 [YS-155] refact: 예외 핸들링 로직 수정 및 500 에러 디스코드 웹훅 알림 추가 Jan 17, 2025
@Ji-soo708 Ji-soo708 requested a review from chock-cho January 17, 2025 04:23
Comment on lines +5 to +7
interface AlertGateway {
fun sendError(e: Exception, request: HttpServletRequest)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 디스코드를 사용하지만, 향후 슬랙과 같은 다른 커뮤니케이션 도구로 변경할 가능성을 고려하여 AlertGateway라는 범용적인 이름을 사용했습니다.

클린 아키텍처 원칙을 따르며, 알림 기능을 추상화함으로써 특정 서비스에 의존하지 않도록 했습니다. 이렇게 하면 다른 알림 서비스로 쉽게 교체할 수 있는 유연성을 확보할 수 있다고 생각합니다!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오호 서버 health check 용도로 즉각적으로 알람이 가도록 설계하셔서, 정말 좋은 것 같습니다!
서버 측에서 즉각 대응이 가능할 것 같아요 💪💪
많이 배워갑니다!

나중에 만약에 정말 많은 MAU를 확보하면, 별도의 모니터링 서버를 두어서 trigger하는 방법도 있다고 생각해요! (이건 아~~주 먼 미래의 이야기일 것 같지만요😅)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋습니다! 현재 FeignClient 등의 외부 API 통신과 연결된 Gateway 인터페이스 쪽은 지수님의 설계처럼 좀 더 범용적인 네이밍을 할 필요가 있는 것 같아요.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

별도의 모니터링 서버를 두어도 좋을 만큼의 MAU가 확보된다면, 트리거 기반의 방식은 효율적이고 확장성 있는 접근법이 될 것 같네요! 👍

Comment on lines +5 to +7
interface AlertGateway {
fun sendError(e: Exception, request: HttpServletRequest)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오호 서버 health check 용도로 즉각적으로 알람이 가도록 설계하셔서, 정말 좋은 것 같습니다!
서버 측에서 즉각 대응이 가능할 것 같아요 💪💪
많이 배워갑니다!

나중에 만약에 정말 많은 MAU를 확보하면, 별도의 모니터링 서버를 두어서 trigger하는 방법도 있다고 생각해요! (이건 아~~주 먼 미래의 이야기일 것 같지만요😅)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

500 에러에 대한 handler 처리가 깔끔하고 좋았어요! 서버에 로그를 찍음으로써 에러의 원인을 좀 더 용이하게 파악할 수 있을 것 같아요! :D!!

Comment on lines +5 to +7
interface AlertGateway {
fun sendError(e: Exception, request: HttpServletRequest)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋습니다! 현재 FeignClient 등의 외부 API 통신과 연결된 Gateway 인터페이스 쪽은 지수님의 설계처럼 좀 더 범용적인 네이밍을 할 필요가 있는 것 같아요.

Copy link
Member

@chock-cho chock-cho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !! 수고하셨습니다 💪💪

@Ji-soo708 Ji-soo708 merged commit bdb301c into dev Jan 17, 2025
3 checks passed
@Ji-soo708 Ji-soo708 deleted the refact/YS-155 branch January 17, 2025 12:47
Ji-soo708 added a commit that referenced this pull request Jan 26, 2025
* feat: implement Discord error alarm notification feature

* refact: delete unused file

* chore: add discord env

* chore: add discord env in test yml

* refact: rename request dto name

* style: delete unused import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ FEATURE 기능 추가 ♻️ REFACTORING 리팩토링
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants