Repository navigation
test(router): isolate request lifecycle counters - #14875
Conversation
Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughRouter request metrics now store counters per instance. Test helpers and KV routers use standalone metrics. Several tests run without serial execution, and the lifecycle test verifies that activity on one router does not change another router’s counters. ChangesRouter metrics isolation
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The counter ownership change is isolated per metrics instance, with test wiring updated accordingly. No merge-blocking issue remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
jthomson04
left a comment
There was a problem hiding this comment.
Code review
Nine comments below, most severe first.
The headline: moving requests_started_total into RouterRequestMetrics does not make it per-router, because from_component still memoizes the whole struct in a process-global OnceLock. Two RoutingHosts in one process (decode + prefill pool in a disaggregated frontend) still share one counter set, so the test-side field override is working around a real production bug rather than fixing it.
The rest split into test-isolation gaps — most test routers still carry the global metrics, and the five dropped #[serial] markers rest on an unverified premise — and cleanups in the new test and helper code.
Review generated with Claude Code. Line references are against ab2494b.
Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
There was a problem hiding this comment.
Previously reported defects still present:
- Original discussion: The previously reported component-ownership defect remains:
RouterRequestMetrics::from_componentstill memoizes the entire metric set in one process-globalOnceLock, so later routing hosts reuse counters registered to the first host's component and router labels. In a disaggregated frontend, this continues to merge/mislabel pool metrics. - Original discussion: The previously reported component-scoping defect is still present:
RouterRequestMetrics::from_componentstill memoizes the entire metrics struct in the process-globalROUTER_REQUEST_METRICS, so laterRoutingHostinstances reuse the first component's registered counter handles rather than getting independently labeled request metrics. - Original discussion: Verified:
RouterRequestMetrics::from_componentstill memoizes the entire metric set in the process-globalROUTER_REQUEST_METRICS. Multiple RoutingHosts in one process therefore share the first host's component-labeled counters, so requests from another pool remain attributed to that first component. The author explicitly deferred this production metrics-ownership defect. - Original discussion:
RouterRequestMetrics::from_componentstill memoizes the entire metrics set in the process-globalROUTER_REQUEST_METRICSOnceLock, so multiple routing hosts in one process share the first component's counters and labels.
Summary
Fix the shared-counter race in
router_request_counters_follow_admission_and_completion_lifecycleand four related tests. The reported CI failure read 40 started requests instead of 39 after a query-only request. Unmarked tests can update the same process-global counters while a serial test runs.Production metric registration, exported names, and global ownership remain unchanged. Component-level production ownership is deferred to a separate change covering registration, recording paths, and exports.
Validation
All builds and tests ran locally outside the sandbox with
dynamo-llm --no-default-featuresand default test concurrency.cargo fmt --all -- --checkandgit diff --checkpassed.Related Issues