Repository navigation
Sentry の初期化設定を簡素化 - #5966
Merged
Merged
Sentry の初期化設定を簡素化#5966
Conversation
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughindex.js の Sentry 初期化をプロダクション限定のガード付きから無条件呼び出しへ変更し、設定を ChangesSentry初期化設定の簡素化
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@index.js`:
- Around line 12-13: tracesSampleRate と profilesSampleRate が全環境で 1.0
に固定されているため、本番での過剰なテレメトリが発生します。修正は index.js の Sentry 初期化箇所で tracesSampleRate と
profilesSampleRate を環境変数(例: process.env.NODE_ENV === 'production' または専用の
SENTRY_ENV)で分岐させ、開発時は tracesSampleRate: 1.0 / profilesSampleRate: 1.0
を、production 時は tracesSampleRate: 0.2 / profilesSampleRate:
0.05(必要に応じて調整可能)を返すように設定してください;参照する識別子は tracesSampleRate と profilesSampleRate
です。
- Around line 9-14: Sentry.init currently enables sendDefaultPii:true and sets
tracesSampleRate/profilesSampleRate to 1.0; change Sentry.init so sendDefaultPii
is false (or gated behind explicit user consent) and implement a beforeSend hook
in Sentry.init to scrub any remaining sensitive fields (IP, cookies, headers,
user info) when consent is absent; also reduce tracesSampleRate and
profilesSampleRate to environment-appropriate values (e.g., 0.1–0.2 for
production, 1.0 for dev) or make them configurable via env vars so production
never uses 1.0 by default.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
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.
概要
Sentry の初期化設定を最小限の構成に整理し、サンプリングレートを抑える。
変更の種類
変更内容
process.env.NODE_ENV === 'production'のガードを撤去し、Sentry を全環境で初期化するよう変更profilingOptions(lifecycle,profileSessionSampleRate,startOnAppStart)を廃止し、profilesSampleRateをフラット記法に整理enableAutoSessionTracking・Replay 関連設定(replaysSessionSampleRate,replaysOnErrorSampleRate,mobileReplayIntegration)を撤去tracesSampleRateを 0.1、profilesSampleRateを 0.02 に引き下げsendDefaultPiiの指定を撤去テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること省略: 変更箇所がリポジトリ直下の
index.jsのみで、src/**等のコード本体パスに該当しないため自動チェック項目は OFF にしている。関連Issue
スクリーンショット(任意)
Summary by CodeRabbit