Sentry アラートルール

SSoT 参照: 各 alert rule の severity (P0/P1/P2/P3) と通知 channel (#parky-alerts / #parky-ops / #parky-deploys / #parky-insights) の 振り分けは notification-strategy.md で定義。 本 runbook は Sentry UI 側の rule 定義 + project filter + action 設定の 手順のみ扱う。

Parky の Sentry プロジェクトに登録する 4 種のアラート定義と、 Sentry UI 上での手動セットアップ手順をまとめる。実 UI 操作 (project filter / action selection) は Sentry が SaaS であり Terraform / API による IaC が現状未整備なので 手動セットアップ が前提。

監査 O-13 (2026-04-28) で要件化。


前提

  • Sentry org: parky (placeholder — 実 org slug は .work/output/parky/...sentry-setup.md 参照)
  • Sentry projects:
    • parky-api (Cloudflare Workers / @sentry/cloudflare)
    • parky-admin (web/portal/admin / @sentry/react)
    • parky-owner (web/portal/owner / @sentry/react)
    • parky-marketing (web/portal/marketing / @sentry/react)
    • parky-home (web/home / Astro SSR)
  • 通知先:
    • Discord webhook#parky-alerts (詳細 webhook URL は 1Password の Discord|Parky Alerts レコード参照)
    • Email[email protected] (内部運用)

R-01. 5xx burst — 5 分窓で 10/min を超過

目的: インシデント検知の主軸。Worker / Pages / SSR で 5xx が急増した瞬間に通知して Disagreement / 大規模障害を検知する。

項目
Trigger When the count of event.type:error level:error over 5 minutes is more than 50 (= 10/min × 5)
Environment production
Project filter parky-api, parky-admin, parky-owner, parky-marketing, parky-home (全 5 project)
Tag filter http.status_code:[500 TO 599]
Action 1 Send a notification via integration: Discord (#parky-alerts)
Action 2 Send a notification via Email to [email protected]
Frequency At most once per 5 minutes (alert spam 防止)

Sentry UI 手順:

  1. Sentry > 各 project > Alerts > Create Alert > Issue Alert
  2. Set conditionsAn issue is seen more than 50 times in 5m を選択
  3. Add filterevent.tag http.status_code is one of 500, 501, 502, 503, 504 等を追加
  4. Then perform these actions で:
    • Send a notification to Discord (integration 経由、事前に webhook 接続)
    • Send an email to [email protected]
  5. Frequency = 5 minutes
  6. Save

R-02. Error budget burn rate 14.4× — 1 時間 fast burn

目的: SLO (docs/ops/slo-error-budget.md) の error budget を 1 時間で 30 日相当の予算を 2% 焼き尽くすペース (14.4×) に達したら通知する。 規定値 1 - SLO target = 0.001 (99.9%) の 14.4× = 1.44% の error rate。

項目
Trigger (Metric Alert) failure_rate() over 1 hour > 0.0144
Environment production
Project filter parky-api のみ (BFF が SLO 主体)
Action Send a notification via Discord (#parky-alerts)
Frequency 1 度通知したら 1 時間 cooldown

Sentry UI 手順:

  1. Sentry > parky-api > Alerts > Create Alert > Metric Alert
  2. Metric = Failure Rate (or Custom Querycount_if(transaction.status, !=, ok) / count())
  3. Threshold = Critical > 0.0144 over 1 hour
  4. Filter = environment:production
  5. Actions > Add Discord integration channel #parky-alerts
  6. Save

備考: slow burn (6 時間 6×) は Phase 2 で追加予定。今回は fast burn のみ登録する。


R-03. Sentry quota — 80% 到達時の email アラート

目的: Sentry org の月次 event quota が 80% を超えたら、quota 上限切れによる データ欠落の前に補充契約 / フィルタ強化の判断ができるようにする。

項目
Trigger Event quota usage > 80% (org-level setting)
Project filter N/A (org-level)
Action Send an email to [email protected]
Frequency 1 日 1 通まで

Sentry UI 手順:

  1. Sentry > Settings > Subscription > Usage Alerts
  2. Notification Threshold = 80%
  3. Recipients[email protected] を登録
  4. Save

備考: org-level alert なので Discord 連携は無い。email 1 系統に限定する。


R-04. Deploy failure — GitHub Actions deploy-*-prod が失敗したら通知

目的: 本番デプロイの異常終了を見逃さない。Sentry の Release tracking に deploy event が出ていない / 失敗 status が来た時に通知する。

項目
Trigger A new release is created with status:failed (Release Webhook)
Project filter parky-api, parky-admin, parky-owner, parky-marketing, parky-home
Action Send a notification via Discord (#parky-alerts)
Frequency Every event (deploy 失敗は希少なので毎回通知)

Sentry UI 手順:

  1. Sentry > 各 project > Settings > Releases > Release Webhooks を確認
  2. GitHub Actions 側で SENTRY_RELEASE: ${{ github.sha }} を渡している前提 (監査 E-08, .github/workflows/deploy-*-prod.yml 参照)
  3. Sentry > Alerts > Create Alert > Issue Alert
  4. Set conditions = A release is created + release.status:failed
  5. Actions = Discord channel #parky-alerts
  6. Save

補完: deploy-*-prod.yml 側でも GH Actions の if: failure() step で Discord webhook を 直接叩く運用を追加する(CI 障害で Sentry 連携自体が失敗するケースをカバー)。 これは別 issue で追跡。


運用メモ

  • 4 ルールは 手動で各 Sentry project に登録する。Terraform Sentry provider は採用していない。
  • 登録後は .work/output/parky/{date}_sentry_alert_rules_setup.md にスクショ + ルール設定値を残す。
  • Discord webhook URL の rotate は 1Password 側で管理 (reference_1password_items)。
  • 月次でルールが正しく発火しているか確認する手順は docs/ops/incident-response.md §定期点検 参照。
↗ Source markdown (sentry-alert-rules.md)