feat(switchyard-server): Record routing overhead metric - #188
Conversation
This is how much time Switchyard added on top of the backend call. This can be very low (passthrough algo) or potentially quite high (classifier algo), so a broad range. Assisted-by: Claude:Opus 5 high Signed-off-by: Graham King <grahamk@nvidia.com>
|
@CodeRabbit review |
✅ Action performedReview finished.
|
WalkthroughChangesRouting overhead metrics
Estimated code review effort: 3 (Moderate) | ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/libsy/src/core/algorithm.rs`:
- Around line 119-120: Replace the shared routed_call completion slot with
per-response timing attribution in create_run_task, carrying each routed call’s
duration alongside its response and using the duration belonging to the response
ultimately selected to serve the run. Remove the last-completion overwrite
behavior and update overhead accounting accordingly. Add a regression test
covering multiple or concurrent routed calls where the selected response is not
the last to complete.
In `@crates/switchyard-server/README.md`:
- Around line 129-132: Update the README explanation of run and routed-call
clock behavior to distinguish their stopping points: the routed-call clock stops
when the streamed handle arrives, while observe_run stops when create_run_task
returns and therefore includes post-call algorithm work in routing overhead.
Remove the inaccurate “Both clocks” wording and preserve the clarification about
SSE relay time and stream completion.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: b077ffc5-567f-4aa7-851d-8bf436b840d6
📒 Files selected for processing (6)
crates/libsy/src/core/algorithm.rscrates/libsy/src/observability.rscrates/libsy/tests/observability.rscrates/switchyard-server/README.mdcrates/switchyard-server/src/metrics.rscrates/switchyard-server/tests/server.rs
This is how much time Switchyard added on top of the backend call. This
can be very low (passthrough algo) or potentially quite high (classifier
algo), so a broad range.
Assisted-by: Claude:Opus 5 high
Signed-off-by: Graham King grahamk@nvidia.com
Summary by CodeRabbit
New Features
Documentation
Tests