Repository navigation
Conversation
Count each shared timeout once per sender or receiver without changing failure recording, terminal status, cache invalidation or abort delivery. Initialize the bounded counter lazily when metrics are enabled and reuse it within a process, including across KV manager lifecycles. Add CPU regressions and real Prometheus subprocess aggregation coverage. Document observer semantics and the existing timeout-path boundary. Adapted-from: 89a7d4b6c834f41c7a943289e0ee1501945c9a6c Source-merge: 1712852a28dc087f4c86b729c406c8c770bfc69e
WyattJia
requested review from
ByronHsu,
Duyi-Wang,
HaiShaw,
JustinTong0323,
ShangmingCai,
fzyzcjy,
hnyls2002,
merrymercy,
sogalin,
sufeng-buaa,
wisclmy0611 and
zijiexia
as code owners
October 4, 2026 15:02
This was referenced Oct 10, 2026
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.
Motivation
The existing bootstrap and transfer failure counters do not distinguish deadline expiry from other failure causes. Repeated polling and warning-once logs also make log counts unsuitable for counting timeout observations.
This is reproducible without a model: give a sender or receiver a 10-second deadline, set its existing start time to 20 seconds before the current time, and call the shared timeout helper repeatedly. The request becomes Failed, but current main records no classified timeout observation. The initial regression suite on main
ab9d8f029c12cda8167f51d46664d643c8771a6efailed eight count assertions across the two paths.Modifications
sglang:kv_transfer_timeouts_total{stage="bootstrap"|"transfer"}with two zero-initialized stages.This does not introduce new deadlines or count transport errors, session recovery, cancellation, or stalled transfers outside the existing shared timeout helpers. Existing phase failure metrics are preserved.
Related work: #41140 is an open lifecycle consolidation that touches the same helpers but does not add classified timeout counters. #34132 adds request outcomes and broad disaggregation abort reasons; it measures a different unit. #34692 already added the missing NIXL bootstrap timeout. This patch instruments that existing behavior.
Production observations
This proposal extracts two observations from a broader internal instrument already running in a disaggregated deployment with four Prefill workers and two Decode workers. On 2026-10-04 UTC, a read-only check confirmed the instrumentation in all six engine containers and 54 fresh event series: nine initialized event categories per worker. The oldest source sample at the snapshot was 16.5 seconds old.
The deployed counter snapshot contained 5 bootstrap-timeout observations, 23 abort observations, and 0 transfer-timeout observations. Over 2026-09-27 14:52:24 to 2026-10-04 14:52:24 UTC, Prometheus
increase()estimates were approximately 5, 23, and 0 respectively, with no counter resets observed for the queried series. These are process/rank observer events, not unique failed requests. The distinction is useful because treating every cancellation as a timeout would obscure the actual deadline-expiry signal.The deployed internal metric is
sglang:kv_failure_events_total{event}. This PR deliberately retains only deadline expiry, names itsglang:kv_transfer_timeouts_total{stage}, and excludes cancellation and the other internal categories. The renamed minimal collector and its current-main adaptations have not been deployed in this environment. The production observations support the need for classification; they do not establish a before/after reduction in failures or validate the transfer-timeout path on hardware. No inference request, fault injection, traffic change, or deployment was performed for this check.Validation
Rebased onto main
affa261e3d289fe4f907c9b2e8d773fef0d36dbaand reran the focused tests and changed-file checks.macOS arm64, Python 3.12.12, PyTorch 2.14.1, Prometheus client 0.26.0:
PYTHONPATH=python python -m pytest \ test/registered/unit/disaggregation/test_kv_transfer_timeout_metrics.py \ test/registered/unit/observability/test_kv_transfer_metrics.py \ test/registered/unit/disaggregation/test_receiver_connection_pool.py \ test/registered/unit/disaggregation/test_kv_transfer_replica_metric.py \ -v -p no:cacheprovider # 20 passed, 14 subtests passedThe two new registered files also pass when executed directly, as CPU CI executes them: 8 timeout tests and 4 collector tests. Changed-file pre-commit checks, Ruff, Python compilation, and
git diff --checkpass. Mintlify 4.2.559 build validation and broken-link checks pass using Node 24.The timeout tests call the real shared timeout, failure-recording, and status-update methods with controlled clocks and mocked I/O boundaries. Multiprocess checks use actual child interpreters, Prometheus counters, and
MultiProcessCollector; they do not exercise a running SGLang server. macOS uses SGLang's own platform compatibility stubs. The full unit suite, Linux CI, server-level metrics export, GPU, multi-node, and RDMA tests were not run.Accuracy Tests
Not applicable. The change adds observations to existing failure paths and does not change model execution or outputs.
Speed Tests and Profiling
No inference benchmark was run. Successful timeout checks return before the new observation logic. Counter increments occur on the first observed expiry of each object.
Checklist
Maintainer review and CI authorization remain pending.
CI States
Latest PR Test (Base): ❌ Run #37211546738
Latest PR Test (Extra): ❌ Run #37211546250
Latest PR Test (AMD ROCm 10): ❌ Run #37211546498