コンテンツにスキップ

2026-04 Sentry uptime monitor automation 要件

背景

  • scheduled-safe-probes.yml は staging / production の safe probe を 30 分ごとに回していたが、定期外形監視と deploy 連動の verification が GitHub Actions に混在していた。
  • production の定期外形監視は Sentry Uptime に寄せることで、downtime issue / trace / release との相関をそのまま使えるようにしたい。
  • 一方で browser synthetic、deploy gate、関係者向け manual Sentry Feedback canary のような multi-step 検証は Sentry Uptime では代替できない。
  • 現時点では Grafana / Prometheus / Loki / log shipper を Fly.io の正式運用 app として常設しない。observability/ 配下の該当設定はローカル確認または将来導入用テンプレートとして保持し、periodic な継続監視は Sentry Uptime を主系とする。

合意事項

1. 正本

  • 外形監視 endpoint の checked-in 正本は observability/external-monitor-endpoints.json とする。
  • endpoint catalog から Sentry 向け monitor 定義を構築する導線は scripts/ops/external-monitor-endpoints.mjs とする。
  • shared endpoint catalog の手動確認は scripts/ops/check-external-monitor-endpoints.mjs からのみ実行する。
  • monitor の list / upsert は scripts/ops/sentry-uptime-monitors.mjs からのみ実行する。pnpm run sentry:uptime は shared catalog を直接読み、 runtime に Sentry 向け monitor 定義を構築する。
  • 実行導線は pnpm run monitor:endpoints:check / just monitor-endpoints-check --target sentry / just sentry-uptime-list / just sentry-uptime-upsert / just sentry-live-config-audit を正規とする。
  • local の just sentry-uptime-list / just sentry-uptime-upsert は login 済みの sentry user auth を既定で使い、CI で SENTRY_AUTH_TOKEN が注入されている場合のみ token transport へ切り替える。
  • org slug と base URL は root .sentryclirc の既定値(org=ritsubi, url=https://sentry.io/)を正とし、必要時のみ SENTRY_ORG / SENTRY_URL で上書きする。

2. 初期 monitor セット

  • 初期セットは production 限定 の conservative default とし、以下 3 本を正規運用とする。
  • Production Storefront readiness
    • project: b2b-commerce-storefront
    • url: https://order.ritsubi-platform.com/api/health/ready
    • interval: 300s
    • verification: 2xx かつ $.status == "ok"$.mode != ""
  • Production Vendure readiness
    • project: b2b-commerce-vendure
    • url: https://commerce.ritsubi-platform.com/health/ready
    • interval: 300s
    • verification: 2xx かつ $.status == "ok"
  • Production Vendure schema drift
    • project: b2b-commerce-vendure
    • url: https://commerce.ritsubi-platform.com/health/ready
    • interval: 300s
    • verification: 2xx かつ $.dependencies.schemaDrift == "ok"
  • traceSamplingresponseCaptureEnabled は全 monitor で有効化する。

3. GitHub Actions に残す範囲

  • 以下は引き続き GitHub Actions の正式運用とする。
  • deploy 前 gate(production-preflight-storefront.yml
  • deploy 後 / 定期 browser synthetic(production-smoke-storefront.ymlscheduled-dashboard-smoke.yml) と manual observability 切り分け(production-sentry-smoke-storefront.yml
  • staging / version endpoint / WordPress login を含む safe probe fallback(scheduled-safe-probes.yml
  • scheduled-safe-probes.ymlmanual fallback とし、Sentry 側の外形監視に異常が出たときの補助確認や staging 確認に使う。

4. 認証と適用前提

  • local は sentry whoami が通る user auth を既定とし、token を必須にしない。
  • CI で SENTRY_AUTH_TOKEN を使う場合は、対象 project の uptime monitor を list / create / update できる権限を持つこと。
  • local / CI ともに token をコードへ保存しない。開発中の確認は --dry-run を使い、payload と upsert plan を確認してから live apply する。
  • uptime endpoint は現時点で Sentry の experimental API を利用するため、Sentry 側の互換性変更があった場合は script 側を更新する。
  • checked-in plan と live state の drift 確認は just sentry-live-config-audit --allow-drift --json を使う。
  • accepted drift の suppressions は observability/sentry-live-config-audit.json で管理し、理由と issue 番号を残す。

受け入れ観点

  1. shared endpoint catalog を直接読んだ just sentry-uptime-upsert --dry-run が成功し、apply 前に plan が確認できること。
  2. local では sentry user auth だけで just sentry-uptime-list / just sentry-uptime-upsert が動作し、同名 monitor を update / create できること。CI では SENTRY_AUTH_TOKEN を注入した同じ command が動作すること。
  3. just monitor-endpoints-check --target sentry または pnpm run monitor:endpoints:check で shared catalog の endpoint 群を一発確認でき、--target sentry で Sentry と同じ json assertion を評価できること。
  4. monitoring runbook に prerequisite / usage / shared catalog の位置づけ / monitor の意味、manual fallback の位置づけが記載されていること。
  5. docs 上で「periodic safe probe は Sentry Uptime」「deploy 連動の深い検証は Actions」「staging / version / WordPress は manual fallback」「Grafana / Prometheus / Loki は現時点で Fly.io 正式運用対象ではない」という整理が明示されていること。
  6. just sentry-live-config-audit で checked-in monitor plan と live state の drift を確認できること。