litellm/tests/unit/proxy/utils/proxy_logging
mateo-berri 0c596b95b1 fix(proxy): log a fallback's image refusal on the deployment that answered
When the client gets a fallback's refusal or 422 after an earlier model
failed another way, its failure row, Prometheus spend and request labels
now go on that fallback's deployment instead of the first one. Prometheus
also counts that attempt in the fallback deployment's success and total
counters, and the billed spend metrics label requested_model with the
group that answered.

Adapted for lts/1.108.x. This line's proxy failure hook lifts the last
attempt's logging object, so its model, price and model_id already name
the fallback that answered, while the request metadata still names the
first deployment. The lift copies that object's model_group and model_id
onto the metadata, which the spend row and Prometheus read first, instead
of looking the deployment up in the router. The deployment_attribution
rename and the per-attempt Prometheus counters are left out, since this
line runs the failure log on every router attempt.

(cherry picked from commit 1277be6ffa)
2026-11-24 16:05:09 -08:00
..
__init__.py
_harness_smoke_test.py
conftest.py test(proxy): delete the legacy proxy test tree and shard tests/unit/proxy by glob (#44018) 2026-10-01 11:40:45 -07:00
test_alerting.py fix(proxy): cooldown errors carry 429, Sentry starts at boot without request bodies, tracing failures log at ERROR, exporter counters exported (#46344) 2026-10-16 00:53:52 +00:00
test_callback_capabilities_class.py
test_callback_capabilities_dataclass.py
test_during_call_hook.py
test_guardrail_pipeline.py fix(guardrails): check a model-level post_call response once across the proxy and deployment layers (#50300) 2026-11-07 07:45:04 +09:00
test_internal_usage_cache.py
test_lifecycle.py fix(proxy): build configured logging callbacks at boot so a broken callback fails startup instead of the first request (#46378) 2026-10-14 16:51:55 +00:00
test_mcp_bridging.py feat(mcp): hand listed-tool description and input schema to pre-call hooks per caller (#41162) 2026-10-04 00:53:58 -07:00
test_module_helpers.py
test_post_call_failure_hook.py fix(proxy): log a fallback's image refusal on the deployment that answered 2026-11-24 16:05:09 -08:00
test_post_call_success_hook.py
test_pre_call_hook.py fix(guardrails): name only the request pipeline steps that ran in x-litellm-applied-guardrails (#49262) 2026-10-31 12:12:55 -07:00
test_streaming_hooks.py