feat(monitoring): renovate, withdrawal and postgres alerts #829

Sammanfogat
supernaut sammanfogade 4 incheckningar från feat/alerts-renovate-refunds-postgres in i main 2026-10-19 22:53:49 +00:00
Ägare

What

Three monitoring changes, one commit each.

  • Refs #589 (partial): RenovateRunSlow fires when every run in the last 3 days took over 90 minutes (the runbook escalation trigger). Peak memory is not alerted: bitborg_renovate_peak_rss_bytes is cgroup memory.peak, which includes page cache and sits near the cap on healthy runs. Cache disk use is covered by the host disk alerts. The runbook says so.
  • Closes #621: Loki rule WithdrawalNeedsManualSettlement on bitborg-web lines matching [withdraw] .*settle by hand (failed refund, stale or invalid request). Same routing as the other Loki rules. Runbook entry "Withdrawal alert". No overlap with #692, which covers the billing container only.
  • Closes #459: postgres_exporter Quadlet unit in monitoring-agent, read-only bitborg_monitor role (member of pg_monitor) created by the postgres role, scrape job postgres, and rules PostgresDown, PostgresExporterSilent, PostgresConnectionsHigh, PostgresLongTransaction, PostgresDeadlocks, PostgresDatabaseGrowing. Runbook section "Postgres alerts".

Dependencies and limits

  • #621 depends on the stable log lines in bitborg-web ([withdraw] refund failed, settle by hand sub=<sub> and [withdraw] request stale or invalid, settle by hand sub=<sub> reason=<stale|invalid>). The regex also matches the older wording.
  • A stale request is only detected when the customer retries, so that line can come days late.
  • The runbook has no "mark reviewed" step: there is no reviewed column. It says to note the manual refund on the Mollie payment.
  • #459: no replication rule, as there are no replicas. The exporter is on both the edge and data networks so vmagent can scrape it and it can reach Postgres.

Operator steps

  • Add vault_postgres_monitor_password (openssl rand -hex 24) to the prod and staging vaults. Applies fail without it.
  • Apply --tags postgres,monitoring-agent on staging, then prod, then --tags monitoring for the rules.
  • Check pg_up, pg_settings_max_connections, pg_stat_database_numbackends and pg_long_running_transactions_oldest_timestamp_seconds exist in Grafana. VacuousAlertRule flags a wrong name after 30 min.
  • Force a refund failure in Mollie test mode on staging and confirm the withdrawal alert (Loki sees prod only, so verify the log line there).
## What Three monitoring changes, one commit each. - Refs #589 (partial): `RenovateRunSlow` fires when every run in the last 3 days took over 90 minutes (the runbook escalation trigger). Peak memory is not alerted: `bitborg_renovate_peak_rss_bytes` is cgroup `memory.peak`, which includes page cache and sits near the cap on healthy runs. Cache disk use is covered by the host disk alerts. The runbook says so. - Closes #621: Loki rule `WithdrawalNeedsManualSettlement` on `bitborg-web` lines matching `[withdraw] .*settle by hand` (failed refund, stale or invalid request). Same routing as the other Loki rules. Runbook entry "Withdrawal alert". No overlap with #692, which covers the billing container only. - Closes #459: `postgres_exporter` Quadlet unit in `monitoring-agent`, read-only `bitborg_monitor` role (member of `pg_monitor`) created by the `postgres` role, scrape job `postgres`, and rules `PostgresDown`, `PostgresExporterSilent`, `PostgresConnectionsHigh`, `PostgresLongTransaction`, `PostgresDeadlocks`, `PostgresDatabaseGrowing`. Runbook section "Postgres alerts". ## Dependencies and limits - #621 depends on the stable log lines in bitborg-web (`[withdraw] refund failed, settle by hand sub=<sub>` and `[withdraw] request stale or invalid, settle by hand sub=<sub> reason=<stale|invalid>`). The regex also matches the older wording. - A stale request is only detected when the customer retries, so that line can come days late. - The runbook has no "mark reviewed" step: there is no reviewed column. It says to note the manual refund on the Mollie payment. - #459: no replication rule, as there are no replicas. The exporter is on both the edge and data networks so vmagent can scrape it and it can reach Postgres. ## Operator steps - [ ] Add `vault_postgres_monitor_password` (`openssl rand -hex 24`) to the prod and staging vaults. Applies fail without it. - [ ] Apply `--tags postgres,monitoring-agent` on staging, then prod, then `--tags monitoring` for the rules. - [ ] Check `pg_up`, `pg_settings_max_connections`, `pg_stat_database_numbackends` and `pg_long_running_transactions_oldest_timestamp_seconds` exist in Grafana. `VacuousAlertRule` flags a wrong name after 30 min. - [ ] Force a refund failure in Mollie test mode on staging and confirm the withdrawal alert (Loki sees prod only, so verify the log line there).
supernaut lade till 4 incheckningar 2026-10-19 19:10:32 +00:00
Fires when every run in the last 3 days took over 90 minutes, the runbook
escalation trigger. Peak memory is not alerted: the metric is cgroup
memory.peak, which includes page cache. The clone cache disk is covered by
the host disk alerts.

Refs #589
Loki rule on the bitborg-web [withdraw] ... settle by hand lines: a failed
refund, or a request that ended stale or invalid. Adds a runbook entry.
Depends on the log lines being stable in bitborg-web.

Closes #621
postgres_exporter runs as a Quadlet unit in monitoring-agent, on the edge
and data networks, as a read-only bitborg_monitor role created by the
postgres role. Rules: Postgres down, exporter silent, connections above
80%, long transaction, deadlocks, database growth.

Closes #459
fix(monitoring): refresh exporter secret, trim collectors, test more Postgres rules
Alla kontroller lyckades
ci / ci (pull_request) Successful in 12m50s
450a132c05
Recreate the exporter podman secret so a rotated password lands. Disable
the per-table collectors, which nothing reads. Document that a long
pg_dump trips PostgresLongTransaction. Add unit tests for the silent,
deadlock and growth rules.

Refs #459
supernaut sammanfogade incheckning a0009f0507 till main 2026-10-19 22:53:49 +00:00
supernaut tog bort grenen feat/alerts-renovate-refunds-postgres 2026-10-19 22:53:49 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
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!829
Ingen beskrivning angiven.