Repository navigation
Fix vec-inf metrics for the metric names current vLLM exports - #335
Open
sunilmehta-si wants to merge 1 commit into
Open
sunilmehta-si wants to merge 1 commit into
sunilmehta-si wants to merge 1 commit into
Conversation
`vec-inf metrics` read vllm:gpu_cache_usage_perc for GPU cache usage. vLLM renamed it vllm:kv_cache_usage_perc in 0.10, hid the old name in 0.11 and removed it in 0.12, so with vllm>=0.11.2 the row always showed 0.0%, even with a full cache. The old name is kept for older servers. The GPU prefix cache hit rate came from vllm:gpu_prefix_cache_hit_rate, which only the V0 engine exported, so the row never appeared. It is now computed from vllm:prefix_cache_hits_total / vllm:prefix_cache_queries_total when the gauge is absent and there has been at least one lookup. Requests Swapped, CPU Cache Usage and CPU Prefix Cache Hit Rate are V0 metrics with no V1 equivalent; their rows now only appear when the server exports them instead of always showing 0. _parse_metrics also added the prefix cache names to the module-level KEY_METRICS dict; it now works on a copy.
This branch has not been deployed
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.
PR Type
Fix
Short Description
vec-inf metricsreads metric names that current vLLM no longer exports, so on the vLLM this project installs (vllm>=0.11.2, 0.22.0 inuv.lock) some rows are wrong or missing:vllm:gpu_cache_usage_perc(hidden by default in 0.11, removed in 0.12)vllm:kv_cache_usage_perc0.0%, even with a full cachevllm:gpu_prefix_cache_hit_rate(V0 engine only)vllm:prefix_cache_hits_total/vllm:prefix_cache_queries_total0Changes:
KEY_METRICSmapsvllm:kv_cache_usage_perctogpu_cache_usage. The old name is kept, so older servers still work._parse_metricscomputesgpu_prefix_cache_hit_ratefrom the two prefix cache counters when the gauge is absent and there has been at least one lookup._parse_metricsused to add the prefix cache names to the module-levelKEY_METRICSdict (key_metrics = KEY_METRICS); it now works on a copy.docs/user_guide.md: the sample output drops the two always-zero rows.Names checked against
vllm/v1/metrics/loggers.pyat v0.11.0, v0.12.0 and v0.22.0.Tests Added
test_parse_metrics_current_vllm_names: vLLM 0.22-style lines give the KV cache usage and a 25% hit rate, with no swapped or CPU cache values.test_parse_metrics_no_prefix_hit_rate_before_lookups: no hit rate while the query counter is 0.test_parse_metrics_does_not_change_key_metrics:KEY_METRICSis unchanged after parsing with prefix caching enabled.test_format_metrics_v1_engine: the table shows75.0%/25.0%and leaves out the three V0 rows.test_format_metrics_with_prefix_cachingnow also checks that the V0 rows still show when the metrics are present.Three of the new tests fail on
main.pytest -m "not integration_test" tests: 238 passed.ruff checkandruff format --check(0.17.1, as in.pre-commit-config.yaml) andmypy vec_infpass. Not run against a live server on a Slurm cluster.