Skip to content

Sentry の初期化設定を簡素化 - #5966

Merged
TinyKitten merged 2 commits into
devfrom
chore/simplify-sentry-config
May 12, 2026
Merged

TinyKitten merged 2 commits into
devfrom
chore/simplify-sentry-config

Conversation

@TinyKitten

@TinyKitten TinyKitten commented May 12, 2026 •

Copy link
Copy Markdown
Member

概要

Sentry の初期化設定を最小限の構成に整理し、サンプリングレートを抑える。

変更の種類

  • バグ修正
  • 新機能
  • リファクタリング
  • ドキュメント
  • CI/CD
  • その他

変更内容

  • process.env.NODE_ENV === 'production' のガードを撤去し、Sentry を全環境で初期化するよう変更
  • UI Profiling 向けの 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

  • Chores
    • エラートラッキングの初期化を全環境で統一しました。設定を簡素化し、トレースとプロファイルのサンプリング率をそれぞれ約10%/2%に設定して本質的な監視に集中させています。

Review Change Stack

@TinyKitten TinyKitten self-assigned this May 12, 2026
@coderabbitai

coderabbitai Bot commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7260a670-1139-4387-887e-5a93c98fcac2

📥 Commits

Reviewing files that changed from the base of the PR and between 043aa24 and 7ac08ec.

📒 Files selected for processing (1)
  • index.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • index.js

📝 Walkthrough

Walkthrough

index.js の Sentry 初期化をプロダクション限定のガード付きから無条件呼び出しへ変更し、設定を dsn、tracesSampleRate (0.1)、profilesSampleRate (0.02) のみに簡素化しました。

Changes

Sentry初期化設定の簡素化

Layer / File(s) Summary
無条件のSentry初期化と設定の簡素化
index.js
Sentry.init の条件付き実行(process.env.NODE_ENV === 'production' ガード)を削除し、無条件で Sentry.init({ dsn, tracesSampleRate: 0.1, profilesSampleRate: 0.02 }) を呼び出すように変更。自動セッション追跡、リプレイ統合、プライバシー/マスキング、詳細プロファイリング設定などの拡張設定は削除。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 小さな一歩で
ガードは消えて
初期化は静かに
三つの鍵だけで
旅路を見守る ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed プルリクエストのタイトルは「Sentry の初期化設定を簡素化」で、変更内容の主要な目的(設定の簡素化)を明確に表現しており、開発者視点から見た重要な変更をよく要約しています。
Description check ✅ Passed プルリクエストの説明はテンプレートの必須セクション(概要、変更の種類、変更内容)をすべて含み、詳細な技術的背景も記載されており、内容が完全です。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/simplify-sentry-config

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5384c7fa-3360-47fc-b33e-784450d0a566

📥 Commits

Reviewing files that changed from the base of the PR and between 737367c and 043aa24.

📒 Files selected for processing (1)
  • index.js

Comment thread index.js Resolved
Comment thread index.js Resolved
@TinyKitten
TinyKitten merged commit d71654d into dev May 12, 2026
3 checks passed
@TinyKitten
TinyKitten deleted the chore/simplify-sentry-config branch May 12, 2026 13:56
@TinyKitten TinyKitten mentioned this pull request May 12, 2026
4 of 9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant