Tag spans with backend identity and operating regime #122
No reviewers
Labels
No labels
autonomy
async-consult
autonomy
epic
autonomy
headless
autonomy
live-collab
coherence-core
priority
P0
priority
P1
priority
P2
priority
P3
priority
P4
qa-fixture
role/ai
role/creator
role/design
role/director
role/engineer
role/exec
role/human
role/ops
role/qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
coilyco-flight-deck/agent-proxy!122
Loading…
Reference in a new issue
No description provided.
Delete branch "backend-regime-spans"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes #109.
litellm_requestp50 3.42s against p99 233.71s was read as a heavy tail. Per #108 it is bimodal - GPU idle and GPU shared with a game. Percentiles describe one population and there were two, which is why three separate pieces of analysis reached for contention, prefill cost, and queueing before anyone asked what else was running on the box.What changes
Backend identity. It already sat on
resilience.attemptandupstream.chat, but not onrequest.chat- the span a latency query actually groups on - and what was there beside it was a client URL, which does not group. Dispatch now stamps the serving backend onto the result, so the identity on the request span reflects which chain entry won, not which was tried first.Capacity state. Every backend carries a regime.
PROXY_BACKEND_REGIMEsets the fleet-wide value; a backend spec entry overrides it with its own"regime"field, so a shared tower and a hosted provider in one chain can report different states. Both attributes ride onrequest.chat,resilience.attempt, and both upstream spans, which makesp99 by backend, by regimereadable.Suggested values:
idle,contended,saturated,hosted,unknown. Nothing enforces the list - it is a grouping key, and an operator needing a sixth value should use one rather than mislabel a run.The default is
unknown, notidleThe proxy cannot observe GPU occupancy today. Defaulting to
idlewould assert something nobody measured, and the whole point of this issue is that unmeasured states were being presented as facts.What this does not do
Nothing derives the regime automatically. That is #108's, specifically its option 3 - capacity state from GPU utilisation via node-stats - and #109 itself flags that the local GPU host's node-stats coverage needs confirming before designing around it. Until then the value is operator-supplied, which is how #108 framed it: the state is known in advance by a human, because nobody starts a game by accident.
That is enough for the third acceptance criterion: a #107 burst run or an #81 sweep can now be shown, after the fact, to have executed against an idle backend, instead of producing a result that looks like model weakness.
How to verify
ward exec test- 3 new cases intests/test_error_spans.py.test_spans_carry_backend_identity_and_regimeassertsrequest.chatcarries both, which it previously did not.test_a_backend_spec_can_declare_its_own_regimeasserts per-backend override beats the fleet default.test_regime_defaults_to_unknown_rather_than_a_guesspins the default.Test plan
ward exec format-check,lint,typecheck,pre-commitall cleanRisk
Low. Additive span attributes and one new optional backend-spec field. No metric labels change:
llm_upstream_latency_secondskeepslogical_modelandbackend, because adding a label to a live histogram changes its cardinality and breaks every query already written against it.Follow-up for Deploy
PROXY_BACKEND_REGIMEwants setting per environment, and the tower backend's spec entry can carry"regime": "contended"for a known shared window. Neither is required for this to be correct.Note
Branched off
queue-wait-measures-the-wait(#120), which sits on #119 and #118. Review those first; this branch contains their commits.