Skip to content

feat(worker): add lk_agents_worker_full_total counter for full-capacity transitions#6389

Open
AKomplished-bug wants to merge 1 commit into
livekit:mainfrom
AKomplished-bug:feat/worker-full-counter-metric
Open

feat(worker): add lk_agents_worker_full_total counter for full-capacity transitions#6389
AKomplished-bug wants to merge 1 commit into
livekit:mainfrom
AKomplished-bug:feat/worker-full-counter-metric

Conversation

@AKomplished-bug

Copy link
Copy Markdown

Summary

Fixes #6388.

The worker's load is exported as an instantaneous gauge (lk_agents_worker_load), but admission control marks the worker WS_FULL on the continuous 0.5s load loop. A spike that puts the worker over threshold for less than one scrape/export interval is invisible to the gauge — the FULL transition falls between samples, so dashboards can't see (or alert on) saturation that actually rejected/deferred jobs.

Change

Add lk_agents_worker_full_total, a monotonic Counter labelled nodename, incremented once per FULL transition at the existing status-change edge in _update_worker_status (guarded by self._previous_status != status, alongside the "full capacity" log line). Being a counter, it never loses an event to sampling, and it rides the same Prometheus→OTLP path as the existing gauges, so it works in both scrape and push deployments.

Operators can then alert on rate(lk_agents_worker_full_total[5m]).

Testing

  • tests/test_worker_full_metric.py — asserts the counter increments per transition and is labelled by node name.
  • ruff check + ruff format clean.
  • mypy (full repo via scripts/check_types.py): no issues found in 617 source files.

@AKomplished-bug AKomplished-bug requested a review from a team as a code owner July 11, 2026 17:23

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Worker full-capacity transitions are invisible to metrics: lk_agents_worker_load gauge misses sub-interval spikes

1 participant