[FE] FEAT: Sentry 도입 #228 #232
Merged
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.
해당 사항 (중복 선택)
설명
🔗 관련 이슈 : closed #228
📝 작업 내용
Sentry는 애플리케이션의 오류 및 성능 문제를 모니터링하고 추적하는 데 사용되는 도구입니다.
0. 설치하기 전
Kong API Gateway에서 CORS Plugin에서 Sentry 로깅을 막습니다.
kong.yml의 CORS plugin 설정에서 Sentry 관련 헤더를 추가해야 합니다.
1. Sentry 설치
Sentry에 필요한 내용을 설치합니다.
2. 환경변수 설정
Sentry DSN을 환경 변수 파일에 추가해야 합니다. .env 파일을 수정합니다.
3. Sentry 초기화 및 설정
src/sentry.ts파일을 생성하여 Sentry 설정을 추가합니다.4. Vite 설정
Sentry Vite 플러그인: 이 플러그인은 Vite 빌드 프로세스 중에 Sentry와 통합하여 소스 맵을 자동으로 업로드하고, 오류 추적을 위한 설정을 간소화합니다. 이를 통해 빌드된 애플리케이션에서 발생하는 오류를 Sentry에서 쉽게 추적할 수 있습니다.
5. 오류 추적 적용 예제
Sentry가 정상적으로 작동하는지 확인하기 위해 App.tsx 또는 특정 컴포넌트에서 오류 추적을 추가할 수 있습니다.
6. 실제 사용 예시
error, ErrorType, ErroMsg 를 받는 logAxiosError 함수를 만들어 로깅할 내용을 커스텀해서 Sentry로 보냅니다.
7. logAxiosError 함수
logAxiosError 함수는 Axios 요청 중 발생한 오류를 Sentry에 로깅하는 역할을 합니다.
HTTP 400 오류는 클라이언트 요청 오류로 간주하고 로깅하지 않습니다.
🏷️ tags (태그)
참고 문서
📸 스크린샷(optional)