Repository navigation
test(integration): wait for the stalled-tenant root span and accept a bare POST name - #49406
Conversation
Merging this PR will not alter performance1 warning
Comparing |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
bugbot run |
[Low impact] This test-only change appears safe to merge SummaryThis PR fixes how one integration test finds each request’s server span. It accepts both bare
Reviews (2) · Last reviewed commit: "test(integration): wait for the stalled-..." · Reviewed by Greptile |
94e1c25 to
fa75833
Compare
|
@greptileai review latest head |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit fa75833. Configure here.
… bare POST name (BerriAI#49406) (cherry picked from commit 8d202fa)
test_stalled_tenant_during_a_mixed_burst_keeps_serving_and_each_teams_policylooked for each request's server span by the name prefix"POST ", in a snapshot taken as soon as the model span arrived. Two things made that snapshot miss the root. When the burst is the first/v1/messagestraffic a proxy sees, the route is still being registered lazily, so the server span is named plainPOST. And the server span ends after the response is sent, so it can land in a later export than the model span. The test now waits for the server span and matchesPOSTwith or without the route, and every other check is unchangedDetails
TLDR
Problem this solves:
/v1/messagestrafficHow it solves it:
POSTRelevant issues
It failed in 6 of the 8 scheduled integration runs on main from 10-29 to 10-31, always at
assert len(roots) == 1with an empty list. The proxy registers the Anthropic/v1/messagesrouter on its first matching request, and the FastAPI instrumentation names the server span from the routes that exist when the span starts. The requests that trigger or wait on that registration therefore get a span namedPOSTwith nohttp.route, and later requests getPOST /v1/messages. Whether the test hits this depends on whether an earlier test in the module already sent/v1/messagesto the same proxyWith only the name match loosened, the test still failed once in 7 runs on the VM, with no server span found at all. Waiting for the server span the same way the test already waits for the model span closes that gap
A live run against Langfuse Cloud shows the same naming on a real proxy, with the first burst named
POSTand the second burst namedPOST /v1/messages. That naming only affects OTel V2 users and the first requests per worker, so this PR leaves the product as is and fixes the testBehavior changes
None. Only one integration test changes
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or moreDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
E2E exception at fa75833. The diff only changes how one integration test finds its root span, so there is no proxy behavior to show before and after
The test runs through the real integration runner with a real proxy, Postgres and OTel sinks, on a Linux VM with 2 workers. On main at 837f36e the stalled-tenant test failed 3 of 3 runs. With this change
Type
✅ Test
Note
Low Risk
Test-only change to integration span polling and naming; no production or proxy behavior modified.
Overview
Fixes flaky
test_stalled_tenant_during_a_mixed_burst_keeps_serving_and_each_teams_policyby changing how it collects each request’s OTel server root span from the operator sink.The test no longer snapshots traces as soon as the model span and marker appear (
_with_content). It noweventuallywaits until a server span is present too, via new helpers_with_rootand_is_root. Root detection accepts span names starting withPOST(covering barePOSTbefore lazy route registration) instead of requiring thePOSTprefix with route.Per-request assertions are unchanged: still exactly one root, then the same redaction vs content twin checks.
Reviewed by Cursor Bugbot for commit fa75833. Bugbot is set up for automated code reviews on this repo. Configure here.