Repository navigation
feat(npu): produce + emit worker metrics (#10697) - #10699
Merged
Merged
Conversation
npu.worker.metrics.updated had subscribers (live UI, cache invalidation) but no
producer — and npu:worker:{id}:metrics was only ever read/deleted, never written.
- _build_worker_metrics(): derive NPUWorkerMetrics from the heartbeat's task
counters + uptime + load — real success_rate, requests_per_minute, peak_load.
- _store_worker_metrics(): setex to npu:worker:{id}:metrics (mirrors
_store_worker_status).
- Heartbeat handler now stores metrics + emits worker.metrics.updated (added to
_WORKER_FULL_DATA_EVENTS so the payload carries the metrics).
avg_response_time_ms needs per-worker latency aggregation → follow-up; this PR
emits the accurately-derivable subset.
Tests: real rate computation, no-traffic defaults, correct Redis key (3 new;
13 existing pulse tests still pass).
Closes #10697. Part of #10602 / umbrella #10603.
Contributor
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
…rent sample) (review #10699)
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.
Thinking Path
Subtask 6.4 of #10602 (umbrella #10603).
npu.worker.metrics.updatedhad subscribers (api/websockets.py,npu_pipeline/invalidation) but no producer — andnpu:worker:{id}:metricswas only read/deleted, never written. The verification initially suggested new counters were needed, but the heartbeat already reportstotal_tasks_completed/failed/uptime_seconds/current_load— enough for real metrics.What Changed (additive — no existing behavior altered)
_build_worker_metrics()— deriveNPUWorkerMetrics(realsuccess_rate,requests_per_minute,peak_load) from the heartbeat counters._store_worker_metrics()—setextonpu:worker:{id}:metrics(mirrors_store_worker_status).worker.metrics.updated(added to_WORKER_FULL_DATA_EVENTSso the payload carries the metrics). The existing_get_worker_metricsreader now returns real data.avg_response_time_ms(needs per-worker latency aggregation) → follow-up #NNNN.Verification
services/npu_worker_manager_pulse_test.py— real rate computation (90/10 → 90% success, 90/2min → 45 rpm), no-traffic defaults, correct Redis key (3 new; 13 existing pulse tests still pass).flake8 --max-line-length=120clean;black/isortclean.Closes #10697. Part of #10602 / umbrella #10603.
Model Used
Claude Opus 4.8 (1M context)