Skip to content

[router] Preserve colons in metric names on /engine_metrics - #37985

Closed
chromecast56 wants to merge 3 commits into
sgl-project:mainfrom
chromecast56:engine-metrics-preserve-colons
Closed

chromecast56 wants to merge 3 commits into
sgl-project:mainfrom
chromecast56:engine-metrics-preserve-colons

Conversation

@chromecast56

@chromecast56 chromecast56 commented Sep 4, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

The gateway replaces colons with underscores in engine scrapes, changing metric names such as sglang:gen_throughput and label values such as org/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.

chromecast56 and others added 2 commits September 16, 2026 06:24
`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
chromecast56 force-pushed the engine-metrics-preserve-colons branch from 1f2ee58 to 26143ef Compare September 16, 2026 06:31
@chromecast56

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Sep 18, 2026
@chromecast56

Copy link
Copy Markdown
Collaborator Author

Closing in favor of smg-project/smg#2636. The gateway is developed in smg-project/smg now, and the in-tree sgl-model-gateway hasn't shipped a release since 0.3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

model-gateway run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant