Repository navigation
fix(otel): register LiteLLM_BackgroundInteractionSettlement as a span table - #44385
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
… table Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
bugbot run |
|
Closing as superseded, #44384 already added LiteLLM_BackgroundInteractionSettlement to _PRISMA_MODELS on main, so merging this would only add a duplicate entry |
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 c4fd1c9. Configure here.
TLDR
Problem this solves:
proxy-infra / Run testsis red on main since797353f13a(fix(otel): name postgres service spans by operation and table #44240)How it solves it:
LiteLLM_BackgroundInteractionSettlementin_PRISMA_MODELSinlitellm/integrations/otel/model/spans.pyUser Flow
Before: an operator tracing the proxy with OTel sees background billing settlement queries as unnamed Postgres spans
"background": truepostgresspan with no table in its nameAfter: the same queries show up named by operation and table, like every other proxy table
"background": truepostgres.insert LiteLLM_BackgroundInteractionSettlementPre-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 more@greptileaito re-request a review after pushing changes)Delays 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
Red main run: run 37136497313, job proxy-infra / Run tests at
4c6c84afb7Failing test:
tests/unit/integrations/otel/test_otel_v2_logger.py::test_every_model_in_the_prisma_schema_is_a_renderable_span_tableCulprit: a merge race between #41955 (
8596fe954d), which added theLiteLLM_BackgroundInteractionSettlementmodel toschema.prisma, and #44240 (797353f13a), which landed later from a branch cut before it. #44240 introduced_PRISMA_MODELSplus a test asserting it equals the schema's model set exactly, so the new model made that equality fail at main tipMechanism:
parse_prisma_queryonly names a query by its model when the model is inPRISMA_RELATIONS, andpostgres_operationonly renderstable_namemetadata from that set. Without the entry, settlement table queries fall back to an unnamed span. The test pins the intended invariant that every schema model renders, so the code was fixed and the test is untouchedProof on this PR at
c4fd1c921c: proxy-infra / Run tests passed (5,454 passed), in run 37137843363, along with every other required checkBefore (4c6c84a)
callbacks: ["otel"]against real Postgres, thencurl -X POST localhost:4711/v1beta/interactions -d '{"agent":"deep-research-pro-preview-12-2025","input":"In one sentence, what is LiteLLM?","background":true}'with a real Gemini key{"id": "v1_ChZHakRCYXZMNkw1cld6N...", "status": "in_progress"}and a pending row appears inLiteLLM_BackgroundInteractionSettlementAfter (c4fd1c9)
curl -X POST localhost:4712/v1beta/interactionsrequest{"id": "v1_ChdHekRCYXR5MUlmX19xd...", "status": "in_progress"}and a pending row appears inLiteLLM_BackgroundInteractionSettlement, so request and billing behavior is unchangedType
🐛 Bug Fix
Caveats (if any)
Low
Final Attestation
Link to Devin session: https://app.devin.ai/sessions/c1360031f5a5497f957e701c52d57a79
Open in Devin Desktop: https://app.devin.ai/desktop/session/c1360031f5a5497f957e701c52d57a79?variant=devin
Note
Low Risk
Single allowlist entry for OTel span naming; no runtime behavior change beyond trace labels and the schema parity test.
Overview
Adds
LiteLLM_BackgroundInteractionSettlementto_PRISMA_MODELSinlitellm/integrations/otel/model/spans.py, so it is included inPRISMA_RELATIONSlike the other Prisma tables.That closes a gap after the settlement model landed in
schema.prisma: Postgres OTel spans for background interaction billing can resolvetable_namemetadata and render aspostgres.{verb} LiteLLM_BackgroundInteractionSettlementinstead of generic unnamed Postgres spans. It also restores the invariant checked bytest_every_model_in_the_prisma_schema_is_a_renderable_span_tableon main.Reviewed by Cursor Bugbot for commit c4fd1c9. Bugbot is set up for automated code reviews on this repo. Configure here.