Skip to content

release: v0.3.4 - timekeeper 次回実行時刻を /metrics で公開 - #127

Merged
rebuildup merged 1 commit into
mainfrom
release-0-3-4
Nov 16, 2026
Merged

rebuildup merged 1 commit into
mainfrom
release-0-3-4

Conversation

@rebuildup

Copy link
Copy Markdown
Collaborator

概要

本番は 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 を追加します。

  • 次回セッション開始時刻を Unix タイムスタンプで公開
  • 何も予約されていなければ series 自体を出さない(disabled と 未予約 を区別できる)
  • 値は /timekeeper コマンドが読むのと同じスナップショットから供給

既存の bot_timekeeper_active_sessions(実行中のセッション数)と組み合わせることで、外部から状態を判定できます。

状態 active_sessions next_session_at
予約済み・待機 0 あり(次回時刻)
セッション実行中 1 あり
無効 / 未予約 0 なし

検証

実際のスケジューラで確認しました。日付が変わった後にプロセスを起動すると、直近の 21:00 JST が公開されます。

--- timekeeper metrics ---
  bot_timekeeper_active_sessions 0
  bot_timekeeper_next_session_at 1794916800

scheduled session: 2026-11-17T12:00:00.000Z = 2026/11/17 21:00:00 (JST)
hours away: 20.54
JST clock: 21:00
PASS: next 21:00 JST session is scheduled
  • lint / type-check / biome / knip / build すべて通過
  • tests/health-metrics-metrics.test.ts に 3 件追加(未予約時は series を出さない / 予約時刻を公開する / クリアで消える)

影響

/metrics に series が 1 つ増えるだけで、既存の挙動は変わりません。マージ後に自動デプロイされ、本番の /metrics で次回 21:00 JST が確認できるようになります。

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.
@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f4bffe9c-b797-4d5c-ba82-ce6c1c3287aa
Commits

Reviewing files that changed from the base of the PR and between 650a539 and 87f85a8.

Files selected for processing: 5

  • CHANGELOG.md
  • package.json
  • src/features/health-metrics/index.ts
  • src/features/health-metrics/metrics.ts
  • tests/health-metrics-metrics.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@rebuildup
rebuildup merged commit 2c74a88 into main Nov 16, 2026
7 checks passed
@rebuildup
rebuildup deleted the release-0-3-4 branch November 16, 2026 15:40
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