litellm/tests/unit/proxy/utils
ryan-crabbe-berri 829d50990d
fix(proxy): build configured logging callbacks at boot so a broken callback fails startup instead of the first request (#46378)
* fix(proxy): build configured logging callbacks at boot so a broken callback fails startup instead of the first request

Startup already built every configured callbacks, success_callback and
failure_callback entry, but through the per-request helper that swallows
every construction error. A callback whose SDK could not be imported (for
example langfuse outside the supported version range) stayed a string, so
the first request on each worker rebuilt it inside function_setup and
returned a 500.

Startup now builds them with a variant that re-raises ImportError naming
the callback, which fails boot. Other construction errors keep the old
non-blocking behavior, and callbacks added at runtime keep the lenient path.

* refactor(proxy): build the configured callback replacements in one pass

Collect the startup-built callbacks with a generator and a frozen mapping
instead of a mutable dict filled in a loop, and drop a docstring that
restated the function body

---------

Co-authored-by: yuneng-jiang <yuneng@berri.ai>
2026-10-14 16:51:55 +00:00
..
helpers fix(proxy): use budget reset window for projected spend alerts (#31942) 2026-10-08 12:02:40 -07:00
prisma_and_spend fix(proxy): accept team-scoped models by their public name on POST /fallback (#45455) 2026-10-08 22:38:38 +00:00
proxy_logging 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
__init__.py test(proxy): move utils, agent_endpoints and endpoint tests into tests/unit/proxy (#44006) 2026-10-01 11:06:42 -07:00