Files
pulse/internal/monitoring
rcourtman acb6bcfff6 Judge PBS and PMG freshness by the live polling interval (#2746)
Non-default organisations run tenant monitors against a detached config
copy (#1619). A saved PBS or PMG polling interval reaches them only as a
runtime override pushed by the system-settings save
(`SetPBSPollingInterval` / `SetPMGPollingInterval`). Their fixed-cadence
schedulers read that override, but `Monitor.resourceStaleThresholds`
still derived the PBS and PMG stale windows from the config copy.

Effect before this change: raising PBS from 1 to 5 minutes left the
stale window at 120s, so a healthy PBS or PMG instance in a non-default
organisation read stale (status `warning`) for part of every poll cycle
until the next restart. Lowering the interval left the window too long.

- `resource_stale_thresholds.go`: `resourceStaleThresholds` derives
PBS/PMG freshness from the same override-aware, clamped setting readers
the scheduler uses. An adaptive scheduler picks its own intervals and
ignores the overrides, so freshness there keeps its existing derivation.
`ResourceStaleThresholdsForConfig` stays config-only for adapter
construction, and the monitor overwrites those thresholds on its next
store update.
- `canonical_guardrails_test.go`:
`TestMonitorResourceStaleThresholdsFollowRuntimePollingOverrides` drives
a monitor with a `MonitorAdapter` through `updateResourceStore`. On
origin/main, a PBS sighting 3 minutes old reads `warning` under a
5-minute override, and the threshold stays 2m under a raised override
and 10m under a lowered one. All subtests pass with the fix. One subtest
also ties thresholds to `baseIntervalForInstanceType` for clamped
overrides (5s, 90s, 2h).
- `monitoring.md`: the derivation note now records the override rule.

Unchanged by design: the default organisation shares the server's config
pointer (the save writes it directly), and a PVE interval save reloads
every monitor from saved config.

Verification: the new test fails on origin/main's
`resource_stale_thresholds.go` and passes with the fix. The full
`internal/monitoring` package passes, and `go vet` is clean.
2026-10-08 10:37:54 +01:00
..
2026-03-18 16:06:30 +00:00
2026-08-27 20:41:08 +01:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-07-11 18:25:17 +01:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00