Repository navigation
release: v0.3.4 - timekeeper 次回実行時刻を /metrics で公開 - #127
Merged
Merged
Conversation
During the v0.3.0-v0.3.3 outage the only way to answer "was the session scheduled, or was the timer lost?" was to read the process logs: the live endpoint said nothing about the schedule, so a missed run looked exactly like a run that was never queued. Add bot_timekeeper_next_session_at (Unix seconds, absent when nothing is scheduled), fed from the same snapshot the /timekeeper command reads. With bot_timekeeper_active_sessions it makes a missed session checkable from outside the process. Verified against the real scheduler: a process started after midnight publishes the coming 21:00 JST slot.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
概要
本番は v0.3.3 で復旧し、
/healthと/readyが 200、discord_ws: connected、storage_lease: heldで稼働中です(https://ido-bata-server-bot.go.altare.global)。この PR は、今回の障害対応で最も情報が欠けていた点を埋めます。timekeeper のセッションが予約されているかを外部から確認する手段がありませんでした。
背景
障害中「セッションが発火しなかった」のか「そもそも予約されていなかった」のかを判別するには、プロセスのログを読むしかありませんでした。稼働中のエンドポイントはスケジュールについて何も公開しておらず、未実行と未予約が見分けられない状態でした。
変更
/metricsにbot_timekeeper_next_session_atを追加します。disabledと未予約を区別できる)/timekeeperコマンドが読むのと同じスナップショットから供給既存の
bot_timekeeper_active_sessions(実行中のセッション数)と組み合わせることで、外部から状態を判定できます。検証
実際のスケジューラで確認しました。日付が変わった後にプロセスを起動すると、直近の 21:00 JST が公開されます。
lint/type-check/biome/knip/buildすべて通過tests/health-metrics-metrics.test.tsに 3 件追加(未予約時は series を出さない / 予約時刻を公開する / クリアで消える)影響
/metricsに series が 1 つ増えるだけで、既存の挙動は変わりません。マージ後に自動デプロイされ、本番の/metricsで次回 21:00 JST が確認できるようになります。