Skip to content

feat(bot): Sentry 에러 모니터링 연동#43

Merged
bbbang105 merged 1 commit intodevfrom
feat/bot-sentry-integration
Mar 13, 2026
Merged

feat(bot): Sentry 에러 모니터링 연동#43
bbbang105 merged 1 commit intodevfrom
feat/bot-sentry-integration

Conversation

@bbbang105
Copy link
Owner

Summary

Discord error-webhook을 Sentry Node SDK로 교체하여 웹과 동일한 구조화된 에러 추적 체계 구축.

Changes

파일 변경
packages/bot/src/lib/sentry.ts NEW — Sentry Node SDK 초기화 (sendDefaultPii: false, DB URL/토큰/JWT 마스킹)
packages/bot/src/lib/error-webhook.ts DELETED — Discord webhook 기반 에러 알림 제거
packages/bot/src/bot.ts reportError()Sentry.captureException(), shutdown 시 Sentry.flush()
packages/bot/src/index.ts Sentry import 첫 줄, main().catch에서 Sentry.captureException + flush
packages/bot/src/job-queue.ts pg-boss 에러 핸들러에 Sentry.captureException 추가
packages/bot/src/api-server.ts 8개 API 엔드포인트 catch 블록에 Sentry.captureException 추가
packages/bot/src/scheduler-registry.ts absent 콜백 catch에 Sentry.captureException 추가
packages/shared/src/config/env.ts DISCORD_ERROR_WEBHOOK_URLSENTRY_DSN (optional)
packages/bot/package.json @sentry/node 의존성 추가
.env.example DISCORD_ERROR_WEBHOOK_URL 제거, SENTRY_DSN 추가
CLAUDE.md 봇 기술 스택/파일/환경변수에 Sentry 반영
docs/ARCHITECTURE.md 봇 Sentry 서브그래프, 에러 처리 테이블, 의존성 추가

Design Decisions

결정 이유
sendDefaultPii: false 봇 환경에서 불필요한 PII 수집 방지
beforeSend에서 DB URL/토큰 스크러빙 PostgreSQL 연결 문자열, Discord 토큰이 에러 메시지에 포함될 수 있음
DSN 없을 때 production 경고 설정 누락 시 조기 발견
error-webhook 완전 제거 Sentry Alert → Discord #서버-에러 채널로 동일 기능 대체

Test Plan

  • SENTRY_DSN 설정 후 봇 시작 → Sentry 이벤트 수신 확인
  • 의도적 에러 발생 → Sentry 대시보드에 이벤트 표시 확인
  • DB URL, Discord 토큰이 Sentry 이벤트에서 마스킹되는지 확인
  • SENTRY_DSN 미설정 + NODE_ENV=production → 콘솔 경고 출력 확인

🤖 Generated with Claude Code

Discord error-webhook을 Sentry Node SDK로 교체하여 구조화된 에러 추적 구현.

- @sentry/node SDK 초기화 (sendDefaultPii: false, PII 스크러빙)
- beforeSend에서 DB URL, Discord 토큰, JWT 마스킹
- bot.ts, index.ts, job-queue.ts, api-server.ts, scheduler-registry.ts에 Sentry.captureException 적용
- process.exit 전 Sentry.flush(2000) 호출로 이벤트 전달 보장
- error-webhook.ts 삭제, env.ts에서 DISCORD_ERROR_WEBHOOK_URL 제거
- CLAUDE.md, ARCHITECTURE.md 봇 Sentry 반영

Co-Authored-By: Claude <noreply@anthropic.com>
@bbbang105 bbbang105 requested a review from choihooo as a code owner March 13, 2026 06:55
@vercel
Copy link

vercel bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
study-admin-web Ready Ready Preview, Comment Mar 13, 2026 6:56am

@bbbang105 bbbang105 added the 🚀 feat 새로운 기능 추가 / 일부 코드 추가 / 일부 코드 수정 (리팩토링과 구분) / 디자인 요소 수정 label Mar 13, 2026
@bbbang105 bbbang105 merged commit f03ce28 into dev Mar 13, 2026
8 checks passed
@bbbang105 bbbang105 deleted the feat/bot-sentry-integration branch March 13, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚀 feat 새로운 기능 추가 / 일부 코드 추가 / 일부 코드 수정 (리팩토링과 구분) / 디자인 요소 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant