monitoring: nothing alerts when the runner controller stops #602

Stängd
öppnade 2026-10-08 21:12:20 +00:00 av supernaut · 0 kommentarer
Ägare

What

The runner controller writes last_loop_ok, last_loop_timestamp_seconds and queued_jobs to a textfile. The dashboard shows them. No alert rule reads last_loop_ok or the timestamp. The controller container is not in monitoring_core_units, so CoreUnitDown ignores it.

Why

A broken controller means CI gets no runners. Nothing pages anyone. The comment at alert-rules.yml.j2:506 says the -1 sentinel is covered by last_loop_ok and textfile staleness. That coverage does not exist.

Failing case

  • The OpenStack application credential expires or the Forgejo admin token is rotated. reconcile() raises every cycle (controller.py:1886). The loop writes last_loop_ok=0 and queued_jobs=-1. The rule queued_jobs > 0 is false for -1, so nothing fires.
  • The controller hangs in an openstacksdk call with no timeout (controller.py:1520). The textfile freezes at queued_jobs=0. Nothing fires.

Fix

Add two rules in ansible/roles/monitoring/templates/alert-rules.yml.j2:

  • bitborg_runner_controller_last_loop_ok == 0 for 10m.
  • time() - bitborg_runner_controller_last_loop_timestamp_seconds > 300 for 5m.

Add the controller container to monitoring_core_units. Correct the comment at line 506. Use the metric prefix variable the other controller rules use.

Done when

  • Both rules exist and pass scripts/check-alert-rules.py.
  • A vmalert unit test shows each rule firing on a stuck or failing loop.
  • The controller is in monitoring_core_units.
  • The comment at alert-rules.yml.j2:506 is accurate.
## What The runner controller writes `last_loop_ok`, `last_loop_timestamp_seconds` and `queued_jobs` to a textfile. The dashboard shows them. No alert rule reads `last_loop_ok` or the timestamp. The controller container is not in `monitoring_core_units`, so `CoreUnitDown` ignores it. ## Why A broken controller means CI gets no runners. Nothing pages anyone. The comment at `alert-rules.yml.j2:506` says the `-1` sentinel is covered by `last_loop_ok` and textfile staleness. That coverage does not exist. ## Failing case - The OpenStack application credential expires or the Forgejo admin token is rotated. `reconcile()` raises every cycle (`controller.py:1886`). The loop writes `last_loop_ok=0` and `queued_jobs=-1`. The rule `queued_jobs > 0` is false for `-1`, so nothing fires. - The controller hangs in an openstacksdk call with no timeout (`controller.py:1520`). The textfile freezes at `queued_jobs=0`. Nothing fires. ## Fix Add two rules in `ansible/roles/monitoring/templates/alert-rules.yml.j2`: - `bitborg_runner_controller_last_loop_ok == 0` for 10m. - `time() - bitborg_runner_controller_last_loop_timestamp_seconds > 300` for 5m. Add the controller container to `monitoring_core_units`. Correct the comment at line 506. Use the metric prefix variable the other controller rules use. ## Done when - [ ] Both rules exist and pass `scripts/check-alert-rules.py`. - [ ] A vmalert unit test shows each rule firing on a stuck or failing loop. - [ ] The controller is in `monitoring_core_units`. - [ ] The comment at `alert-rules.yml.j2:506` is accurate.
Logga in för att delta i denna konversation.
Ingen milstolpe
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-infra#602
Ingen beskrivning angiven.