feat: Sentry SDK の導入 - #489
Draft
Ojoxux wants to merge 2 commits into
Draft
Conversation
Add shared createLogger utility and client-side telemetry sinks so debug console.log can be replaced with environment-aware logging. Sentry hooks are stubbed for web (window.Sentry) and API (SENTRY_DSN) until DSN is configured. Document observability env vars in .env.example.
Add @sentry/nextjs with instrumentation hooks and global error boundary. Add @sentry/hono middleware for the Cloudflare Workers API. DSN is read only from environment variables so secrets stay out of the repository.
Draft
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.
Pull Request 概要
Sentry SDK を導入し、ブラウザ・API のエラーを環境変数経由で Sentry に送信できるようにする。DSN 未設定時は SDK を初期化せず、既存動作への影響を避ける。
テレメトリ基盤(
createClientLogger)を含む。#487 と同一内容。変更内容
apps/webに@sentry/nextjsを追加(instrumentation、global-error、withSentryConfig)apps/apiに@sentry/hono/@sentry/cloudflareを追加(Hono ミドルウェア、500 エラー送信)packages/utilsにcreateLoggerテレメトリ基盤を追加apps/web/src/lib/telemetryにクライアント向けロガーと Sentry シンクを追加.env.exampleに Sentry 関連の環境変数を追記(値は空欄)動作確認
npm run build --workspace=@sonory/webが成功することnpm run type-check --workspace=@sonory/apiが成功すること環境変数の設定(マージ後・各自で実施)
.envにNEXT_PUBLIC_SENTRY_DSNwrangler secret put SENTRY_DSN --env stagingNEXT_PUBLIC_SENTRY_DSNを wrangler vars またはダッシュボードで設定関連Issue
レビューポイント
sendDefaultPii: falseで位置情報等の自動送信を無効にしていることtracesSampleRateが 0.1 であること