Rework worker stats: configurable consumers, occupancy tracking - #377
Draft
neob91-close wants to merge 3 commits into
Draft
Rework worker stats: configurable consumers, occupancy tracking#377neob91-close wants to merge 3 commits into
neob91-close wants to merge 3 commits into
Conversation
neob91-close
force-pushed
the
andrzej/p2/worker-duty-cycle-stats
branch
from
August 4, 2026 12:46
55c6988 to
f5f0b64
Compare
neob91-close
force-pushed
the
andrzej/p2/worker-duty-cycle-stats
branch
from
August 5, 2026 15:45
e942db4 to
3423df6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
utilizationcounts only in-task time, so a worker saturated with many short tasks reads well below 100% — the between-task overhead is invisible. This broke our utilization-based autoscaling: workers scaled down under a large backlog.The worker now also measures idle time (blocking waits for work) and reports busy + idle to a configurable
STATS_CONSUMERSlist, replacing the always-on stats thread. The bundledStatsThreadconsumer addstime_idle,time_overhead, andoccupancy = 100 * busy / (busy + idle)— the busy share of attributable time; ~100 when saturated regardless of overhead, 0 when idle.STATS_INTERVALremoved; the periodicstatsline no longer logs by default. Restore withSTATS_CONSUMERS=[StatsThread(log, interval=60)].StatsThread(tiger)→StatsThread(log, interval);worker.StatsThreadis gone, so monkey-patching it silently stops working — subclassstats.StatsConsumerand register viaSTATS_CONSUMERS.Worker.stats_thread→Worker.stats(list of consumers).Commit 1 reworks the measurement; commit 2 redefines
occupancyto exclude overhead.