monitoring(forgejo): make the actions_runners metric duplicate-proof #75
Loading…
Reference in a new issue
No description provided.
Delete branch "wt/t_290ff037"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
forgejo/cnpg-pg(CNPG instance-manager exporter onpg-1) returned HTTP 500 on every scrape, so everyForgejo DB metric was missing — all
cnpg_actions_*queue/runner series did not exist and 8 panels on theforgejo-runnersdashboard were EMPTY.Root cause:
action_runnerheld three rows namedsiriussec-amd64(id 8 = the live identity from therunner's
runner.ini; ids 15/16 = soft-deleted tombstones left by theforgejo→ci-runnersmove), andactions_runnersselectedr.nameas therunnerlabel with no filtering or aggregation. The exporter treatsa duplicate name+label set as a programming error and fails the entire
/metricsresponse, takingpg_stat_*/cnpg_pg_*down with it.Changes (
apps/base/forgejo/pg-actions-queries.yaml)WHERE r.deleted IS NULL— Forgejo soft-deletes a removed runner (deleted= epoch, row kept); thosetombstones are not runners and are hidden from the admin API, but a raw table read sees them.
GROUP BY r.namewithmax(r.last_online)— the label is the name, so no duplicate name can ever produce aduplicate series again; "most recent poll per name" is the intended semantic anyway.
cnpg.io/reload: ""label — the instance manager now re-reads the queries when the ConfigMap changes (livereload, no PostgreSQL restart, no
kubectl cnpg reload). Without it a query fix appears to do nothing and theendpoint keeps 500ing.
Verification (live, before this PR was opened)
curl :19187/metrics→ HTTP 200, 429cnpg_*series (was 500 / 0).cnpg_actions_runners_last_online_seconds→ exactly one series each forpi-runner,pi-deploy-arm64,siriussec-amd64(3 rows total).cnpg_actions_*series present;cnpg_actions_queue_depth 0,cnpg_actions_running_total 3,1h/24h job windows populated.
pg-1stillcreationTimestamp 2026-11-21T17:33:42Z,restartCount 2(unchanged).Card: t_290ff037