Worker full-capacity transitions are invisible to metrics: lk_agents_worker_load gauge misses sub-interval spikes
Bug / gap
The worker exports its load as an instantaneous gauge (lk_agents_worker_load, set from self._worker_load in telemetry/metrics.py::_update_worker_load). Admission control, however, runs on the continuous 0.5s _load_task loop and flips the worker to WS_FULL the moment effective_load >= load_threshold (worker.py::_update_worker_status).
Because the gauge's value is only observed at scrape / OTLP-export time (typically 5–15s), a load spike that marks the worker FULL for less than one export interval lands between observations. The gauge shows a value well under the threshold while the worker was actually full and refusing/deferring jobs. There is no metric that records the FULL transition itself.
Real-world impact
We hit this on a SIP-telephony deployment: a burst of ~7 concurrent jobs pushed one worker to load 0.96 (threshold 0.85), which logged worker is at full capacity, marking as unavailable and recovered ~2.5s later. But the lk_agents_worker_load gauge for that window peaked at only ~0.82 — the 0.96 spike fell between samples. The metric flatly contradicted the log, making saturation impossible to alert on or investigate from dashboards alone.
A gauge cannot fix this — it's lossy by construction (last-sample-wins). A discrete "worker became FULL" event needs a monotonic counter, which never drops events between samples.
Proposed fix
Add lk_agents_worker_full_total (a prometheus_client.Counter labelled nodename), incremented once per FULL transition at the existing status-change edge in _update_worker_status (right where the "full capacity" log line is emitted, guarded by self._previous_status != status). It rides the same Prometheus→OTLP path as the current gauges, so it works in both scrape and push deployments. Operators can then alert on rate(lk_agents_worker_full_total[5m]) and see saturation the load gauge misses.
Happy to send a PR (have one ready).
Hi, I'm Himanshu, exploring a first contribution around worker metrics. I saw #6389 already implements the counter and tests. Would independent validation of AVAILABLE -> FULL -> FULL -> AVAILABLE -> FULL (two increments, not three), or documentation of the metric's meaning, still be useful? I'd appreciate guidance on a small remaining task rather than duplicating the fix.