Repository navigation
[router] Preserve colons in metric names on /engine_metrics - #37985
Closed
chromecast56 wants to merge 3 commits into
Closed
chromecast56 wants to merge 3 commits into
chromecast56 wants to merge 3 commits into
Conversation
`aggregate_metrics` replaced every ':' in the scraped text with '_' to work around openmetrics-parser's Prometheus grammar, which only accepts `[a-z0-9_]` in metric names. That rewrote every SGLang engine metric (`sglang:...` -> `sglang_...`) and any label value containing a colon, so Prometheus queries and dashboards written against the engine's /metrics return nothing when pointed at the router's /engine_metrics (sgl-project#12618). Swap colons for a sentinel the grammar accepts before parsing and restore them in the rendered output. The existing fixture test now expects the engine's real names; a new test covers a colon in both the metric name and a label value. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
chromecast56
force-pushed
the
engine-metrics-preserve-colons
branch
from
September 16, 2026 06:31
1f2ee58 to
26143ef
Compare
Collaborator
Author
|
/tag-and-rerun-ci |
2 of 4 tasks
Collaborator
Author
|
Closing in favor of smg-project/smg#2636. The gateway is developed in smg-project/smg now, and the in-tree |
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.
Motivation
The gateway replaces colons with underscores in engine scrapes, changing metric names such as
sglang:gen_throughputand label values such asorg/model:v1. This breaks existing dashboard queries.Modifications
Preserve colons through parsing and rendering using an escape marker absent from the input and added labels.
Accuracy Tests
Seven tests cover metric names, scraped labels, added worker addresses, histograms, invalid input, and escape-marker collisions. The locked Cargo test run is pending after test consolidation.
Speed Tests and Profiling
Adds an input scan to select the escape marker. Aggregation overhead has not been benchmarked.
CI States
Latest PR Test (Base): ✅ Run #35402526847
Latest PR Test (Extra): ❌ Run #35402526661
Latest PR Test (AMD ROCm 10): ➖ No AMD PR run found for this commit.