[Bugfix][Router] Treat a /metrics scrape with no recognized vLLM metrics as a failed scrape #1226
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.45) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 291 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.340
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #1226"
general
weight: 0.35
chrikrah
Fixes #1074
Problem
EngineStats.from_vllm_scrape()reads a fixed set ofvllm:metrics and starts every field at zero. When a backend's/metricscontains none of them (a different engine, a relabeling proxy, or a vLLM version that renamed them), it still returns an all-zeroEngineStats, and the scraper stores it as a successful scrape. The backend then looks idle, with a 0% prefix cache hit rate, and nothing is logged.The issue describes the impact on load-aware routing. On current
mainthe routers use the router's own in-flight request counts (since #1089 and #1108), so the remaining impact is on observability: the router's/metricsexport (and the Grafana dashboard built on it) and the periodic engine-stats log line report false zeros for that backend.Change
from_vllm_scrape()returnsNonewhen the scrape contains none of the recognized metrics, including an empty scrape. A scrape with at least one recognized metric is parsed exactly as before._scrape_one_endpoint()logs a warning naming the backend URL and returnsNone, the same path as a failed request. The backend is left out ofengine_stats, and because the router clears its per-backend gauges before each export, its series disappear from the router's/metrics. Dashboards show "no data" for it instead of 0.Tests
New
src/tests/test_engine_stats_unrecognized.py:NoneNone_scrape_one_endpoint()returnsNoneand warns with the backend URLThree of these fail on
mainand pass with this change. The fullsrc/testssuite passes (230 tests). black, isort, ruff (onsrc/tests) and codespell are clean.Possible follow-up (not in this PR)
A backend that exports only some of the metrics still reports the missing ones as 0. A follow-up could make the
EngineStatsfields optional and skip unset values when exporting and logging, so the router only reports metrics it actually received. I'm happy to open that if it would be useful.🤖 Generated with Claude Code
https://claude.ai/code/session_01LFWhq5wm3BF7aAhiqfmDGm