Repository navigation
Conversation
3 tasks done
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.
Expose /metrics as a projection of the same StatsTracker used by /v1/stats. Token counters are read directly from existing admitted/sampled totals; timing histograms observe each shared-generation RequestRecord once. A new scheduler -> tokenizer -> frontend queue snapshot supplies real running/waiting counts, including zero after abort/idle transitions. Unknown queue/pool values are omitted rather than fabricated, and registries are per tracker.
Timing preserves existing desktop behavior: streaming records have TTFT, buffered records do not. E2E covers shared chat/Messages/Responses generation; TPOT is the per-completed-stream mean after the first output. Raw /generate and legacy text completions contribute engine counters but are excluded from timing histograms because their middleware records before a stream finishes. See docs/server-hardening/03-metrics.md for semantics and vLLM/SGLang/TensorRT-LLM comparisons.
Validation on Windows x86-64 / Python 3.13.5: 568 passed for tests/server plus scheduler queue metrics, scheduler status and cost-accounting tests. All 5 tests/scheduler/test_abort_inflight_prefill.py tests also passed. New metrics/queue tests cover real Prometheus parsing, counter equality, late aborted tokens, ring eviction, repeated scrapes, IPC codecs and frontend telemetry. Targeted Ruff E4/E7/E9/F and git diff --check passed.
Reproduce: PYTHONPATH=python pytest -q tests/server tests/scheduler/test_queue_metrics.py tests/scheduler/test_scheduler_status.py tests/scheduler/test_cost_accounting_core.py tests/scheduler/test_abort_inflight_prefill.py. The Windows native CPU radix build required ninja on PATH and CL=/std:c++20; initial missing-dependency/compiler failures were resolved without changing kernel code. CPU/fake-backend tests only: no live GPU, checkpoint, multi-rank IPC or performance validation is claimed.
Adds prometheus-client>=0.20,<1 and additive IPC message types; run workers/frontend from the same checkout. No linked issue was supplied. AI-assisted draft at the user's request; human review and real-server validation remain required before merge.
Combined review evidence
All seven independent changes were also merged on the integration branch. The combined server and targeted scheduler run passed 779 tests; the branch records the configuration/error-handler conflict resolutions and detailed validation scope.
Validation host: Windows/Python 3.13.5 with existing PyTorch 2.13.0+cu126, outside the project's pinned 2.11 range. Results are scoped CPU server/state-machine evidence; they do not establish compatibility with the pinned production environment or real GPU/model execution.