Repository navigation
[Bugfix][Router] Read vllm:kv_cache_usage_perc for KV cache usage - #1118
Conversation
vLLM renamed vllm:gpu_cache_usage_perc to vllm:kv_cache_usage_perc and newer releases (e.g. v0.31) only export the new name, so EngineStats reported 0 KV usage for every engine. Accept both names. Part of vllm-project#1074. Signed-off-by: Muhammad Ibrahim <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request updates the EngineStats.from_vllm_scrape method to support both the legacy vllm:gpu_cache_usage_perc and the new vllm:kv_cache_usage_perc metric names, ensuring compatibility with newer vLLM releases. It also adds corresponding unit tests to verify that both metric names are correctly parsed. There are no review comments, so I have no feedback to provide.
…metric Signed-off-by: Muhammad Ibrahim <[email protected]>
…metric Signed-off-by: Muhammad Ibrahim <[email protected]>
Signed-off-by: Muhammad Ibrahim <[email protected]>
|
Nice fix. The prefix cache counters were renamed too: vLLM 0.27.1 registers vllm:prefix_cache_queries and vllm:prefix_cache_hits (exposed with _total), but engine_stats.py still matches vllm:gpu_prefix_cache_queries_total / _hits_total, and there is no gpu_prefix_cache_hit_rate gauge in v1 anymore. So those router stats would stay 0 on current vLLM too. Might be worth covering in this PR. (From reading the code, I have not run the router.) Qaiser |
Resolve the conflict with vllm-project#1118 in engine_stats.py: keep the per-engine aggregation, and read both vllm:gpu_cache_usage_perc and the renamed vllm:kv_cache_usage_perc into the per-engine KV cache usage. Signed-off-by: Muhammad Ibrahim <[email protected]>
Resolve the conflict with vllm-project#1118 in engine_stats.py: keep the per-engine aggregation, and read both vllm:gpu_cache_usage_perc and the renamed vllm:kv_cache_usage_perc into the per-engine KV cache usage. Signed-off-by: Muhammad Ibrahim <[email protected]>
* [Bugfix][Router] Read vllm:kv_cache_usage_perc for KV cache usage (vllm-project#1118) Signed-off-by: Muhammad Ibrahim <[email protected]> * [Doc] Add Simplified Chinese translation (README.zh.md) (vllm-project#1136) Signed-off-by: YE <[email protected]> * [CI/Build] Run helm unittest in CI and fix two broken tests (vllm-project#1131) Signed-off-by: zjjkee <[email protected]> * [Bugfix][Router] Key request stats by dispatch, not by X-Request-Id (vllm-project#1115) Signed-off-by: David-Wu1119 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Rui Zhang <[email protected]> * [Bugfix][Router] Use least-inflight for PrefixAware below-threshold fallback (vllm-project#1089) Signed-off-by: Dundy Pasupuleti <[email protected]> * [Bugfix][Router] Keep P/D model labels when dynamic config reloads the router (vllm-project#1129) Signed-off-by: MinJun Choi <[email protected]> * [Bugfix] Match KEDA scalers to enabled model deployments (vllm-project#1142) Signed-off-by: bojiang-li <[email protected]> * [Router] added pooling route (vllm-project#1112) Signed-off-by: [email protected] <[email protected]> Co-authored-by: [email protected] <[email protected]> Co-authored-by: Rui Zhang <[email protected]> * [CI] Drop host docker prune from runner-cleanup workflow (vllm-project#1174) Signed-off-by: Rui Zhang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * [Feat][Router] Add /v1/systemone and /v1/decisions routes (vllm-project#1173) Signed-off-by: Shern Shiou Tan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * [CI/Build] Stop k8s routing tests when the engine pods never become ready (vllm-project#1134) Signed-off-by: MinJun Choi <[email protected]> * [Bugfix][Router] Upgrade aiohttp and vllm (0.33.0) to resolve router image CVEs (vllm-project#1185) Signed-off-by: Shern Shiou Tan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * Bump chart version to 0.1.14 (vllm-project#1190) Signed-off-by: Rui Zhang <[email protected]> --------- Signed-off-by: Muhammad Ibrahim <[email protected]> Signed-off-by: YE <[email protected]> Signed-off-by: zjjkee <[email protected]> Signed-off-by: David-Wu1119 <[email protected]> Signed-off-by: Dundy Pasupuleti <[email protected]> Signed-off-by: MinJun Choi <[email protected]> Signed-off-by: bojiang-li <[email protected]> Signed-off-by: [email protected] <[email protected]> Signed-off-by: Rui Zhang <[email protected]> Signed-off-by: Shern Shiou Tan <[email protected]> Signed-off-by: MinJun Choi <[email protected]> Signed-off-by: Rui Zhang <[email protected]> Signed-off-by: Bernardo Donadio <[email protected]> Co-authored-by: Muhammad Ibrahim <[email protected]> Co-authored-by: YE <[email protected]> Co-authored-by: Jingke zou <[email protected]> Co-authored-by: Yanze (David) Wu <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Rui Zhang <[email protected]> Co-authored-by: Dundy Pasupuleti <[email protected]> Co-authored-by: MinJun Choi <[email protected]> Co-authored-by: Bojiang Li <[email protected]> Co-authored-by: MaelvanDijk <[email protected]> Co-authored-by: [email protected] <[email protected]> Co-authored-by: Shern Shiou Tan <[email protected]>
What this PR does / why we need it:
vLLM renamed
vllm:gpu_cache_usage_perctovllm:kv_cache_usage_perc, and newer releases (e.g. v0.31) only export the new name.EngineStats.from_vllm_scrapeonly reads the old name, so every engine reports 0 KV cache usage to the router — any routing or dashboard logic that looks at KV usage silently sees idle engines. This is one concrete case of #1074.The fix accepts both metric names into the existing
gpu_cache_usage_percfield (no API change).Test: new
src/tests/test_engine_stats_kv_usage.py(new name read, legacy name still read); it fails onmain. Full router test suite: 184 passed.Part of #1074.