[Feat][Router] Add per-algorithm routing decisions counter (Refs #474)#951
Open
banlor wants to merge 2 commits into
Open
[Feat][Router] Add per-algorithm routing decisions counter (Refs #474)#951banlor wants to merge 2 commits into
banlor wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new Prometheus metric, routing_decisions_total, to track routing decisions across all router implementations. It adds logic to record these decisions with labels for server, model, algorithm, and outcome. Feedback suggests that the KvawareRouter should specifically record a fallback outcome upon a KV cache miss when a session ID is present, and that the test suite should be updated accordingly.
…-project#474) Adds Prometheus counter `vllm:routing_decisions_total{server, model, algorithm, outcome}` recording every routing decision. Outcome distinguishes the algorithm's primary path from internal fallbacks (session router with no session id, kv-aware below match threshold). Orchestrated disaggregated routing is instrumented at `select_prefill_endpoint` / `select_decode_endpoint` since the production flow bypasses `route_request`. Signed-off-by: Mikhail Basov <Michael.S.Sinclair@protonmail.com>
The whole KV-cache miss branch is a degradation from kv-aware's primary path (cache lookup), so both session-id hash-ring and QPS sub-branches record outcome=fallback. Previously only the QPS path was marked fallback, which understated KV-aware misses in the metric. Signed-off-by: Mikhail Basov <Michael.S.Sinclair@protonmail.com>
cf970c4 to
16df357
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.
Routing decision counter for #474. Counter
vllm:routing_decisions_total{server, model, algorithm, outcome}, incremented once per routing decision.outcomeissuccessfor the algorithm's primary path,fallbackwhen an algorithm degrades (session router without session id falls back to QPS, kv-aware below match threshold falls back to session/QPS).Orchestrated disaggregated routing is instrumented inside
select_prefill_endpoint/select_decode_endpointrather thanroute_request, becauseroute_orchestrated_disaggregated_requestbypassesroute_request. Two decisions per request, prefill and decode.DisaggregatedPrefillRouter(non-orchestrated) is not instrumented:prefill_clientanddecode_clientare bound to fixed URLs at startup, no per-request routing.Out of scope: retry outcome. No retry loop exists on the routing path today (
max_instance_failover_reroute_attemptsis parsed but unused). Will follow up if retry lands.Tests in
src/tests/test_routing_metrics.pycover round-robin, session (both branches), kv-aware fallback, orchestrated disaggregated, and the None-label defensive path.Refs #474
-swhen doinggit commit[Bugfix],[Feat], and[CI].Detailed Checklist (Click to Expand)
Thank you for your contribution to production-stack! Before submitting the pull request, please ensure the PR meets the following criteria. This helps us maintain the code quality and improve the efficiency of the review process.
PR Title and Classification
Please try to classify PRs for easy understanding of the type of changes. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:
[Bugfix]for bug fixes.[CI/Build]for build or continuous integration improvements.[Doc]for documentation fixes and improvements.[Feat]for new features in the cluster (e.g., autoscaling, disaggregated prefill, etc.).[Router]for changes to thevllm_router(e.g., routing algorithm, router observability, etc.).[Misc]for PRs that do not fit the above categories. Please use this sparingly.Note: If the PR spans more than one category, please include all relevant prefixes.
Code Quality
The PR need to meet the following code quality standards:
pre-committo format your code. SeeREADME.mdfor installation.DCO and Signed-off-by
When contributing changes to this project, you must agree to the DCO. Commits must include a
Signed-off-by:header which certifies agreement with the terms of the DCO.Using
-swithgit commitwill automatically add this header.What to Expect for the Reviews
We aim to address all PRs in a timely manner. If no one reviews your PR within 5 days, please @-mention one of YuhanLiu11
, Shaoting-Feng or ApostaC.