litellm/tests/unit/proxy/proxy_server
yujonglee 46b5e0e4f2
refactor(rust): log from the core crates with tracing instead of host calls (#54788)
* refactor(rust): log from the core crates with tracing instead of host calls

router-core asked its host to write two model info log lines through an
awaited lookup, and the model capacity engine asked its host for every
warning and error line plus a fixed "unlicensed priority" line. A log line
is not something only the host can answer, so both crates now emit these
lines with tracing and the three host surfaces are gone from the traits,
from the native and Python hosts and from the Python answering code.

The Python proxy still gets the same lines at the same level on the same
logger. The bridge already delivers tracing events to Python logging, so
its target table now sends the capacity crate to "LiteLLM Proxy" and
router-core's model info module to "LiteLLM Router", and a model info
query runs under the calling request's logger so a level change is seen
at once.

A line logged on a runtime task is queued and handed to Python from the
blocking pool, so it can land after the call that logged it returns. The
bridge gains native_log_lines_delivered(), an awaitable that resolves once
the queued lines are delivered, and the capacity tests await it before
reading each step's lines.

* refactor(rust): name the log delivery wait rust_log_lines_delivered

The Rust workspace says "Rust", not "Native", for something written in Rust.

* fix(proxy): deliver queued Rust log lines before the proxy shuts down

A log line a Rust runtime task queued could be lost when the proxy stopped
before the queue was drained. Shutdown now waits for the queue, after the
steps that can still log.

The queue also reported its dropped-line count only when a later batch
arrived, so a drop during the last batch was never reported. It is now
reported once the queue is empty, and a delivery wait ends only after that
report.

* fix(proxy): bound the shutdown wait for queued Rust log lines

The wait had no timeout, so a log handler that stalled would hold worker
shutdown until an outside kill. It now gives up after five seconds or when
the graceful shutdown window runs out, whichever comes first. A timeout is
not logged, because a stalled handler holds its lock and the warning would
block on it too.
2026-11-27 14:53:04 +09:00
..
.coverage_baseline
__init__.py
_coverage_check.py
_pin_check.py
conftest.py fix(router): make the constructor stub work for mypy and guard it in CI (#50354) 2026-11-22 21:25:00 +00:00
test_background_health.py feat(proxy): skip blocked deployments in background health checks (#52761) 2026-11-24 07:53:23 -08:00
test_exception_handlers.py feat(proxy): let operators omit x-litellm-* response headers (#52949) 2026-11-19 15:27:34 -08:00
test_harness_smoke.py
test_lifecycle.py refactor(rust): log from the core crates with tracing instead of host calls (#54788) 2026-11-27 14:53:04 +09:00
test_openapi_customization.py feat(proxy)!: make Scalar the default API reference and remove ReDoc (#53063) 2026-11-23 10:49:54 -08:00
test_proxy_config.py fix(openrouter): report the context window and output cap from OpenRouter's catalog (#54046) 2026-11-24 04:37:30 -08:00
test_routes_anthropic_beta.py
test_routes_assistants.py fix(proxy): keep the mapped status on assistants and threads route errors (#44994) 2026-10-09 16:55:15 -07:00
test_routes_audio.py fix(proxy): return text, srt and vtt transcriptions as plain text (#53255) 2026-11-23 10:17:30 -08:00
test_routes_chat_completions.py fix(azure): drop the traceback from stream-cut errors sent to clients and alerts (#51760) 2026-11-14 08:00:58 +00:00
test_routes_completions.py fix(azure): drop the traceback from stream-cut errors sent to clients and alerts (#51760) 2026-11-14 08:00:58 +00:00
test_routes_config.py feat(proxy): require customer headers by gateway, team, or key (#53045) 2026-11-21 20:20:26 +00:00
test_routes_embeddings.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_routes_invitation.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_routes_login_sso.py feat(proxy): delete the old username and password login page (#53205) 2026-11-20 22:41:08 +00:00
test_routes_misc.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
test_routes_model_cost_map.py refactor(model-cost): move the cost map inputs, fetch and register_model overlay into Rust (#50501) 2026-11-10 02:37:35 +00:00
test_routes_model_info.py fix(openrouter): report the context window and output cap from OpenRouter's catalog (#54046) 2026-11-24 04:37:30 -08:00
test_routes_model_metrics.py
test_routes_models.py refactor(proxy)!: remove the TypeSafe pass-through route in favor of the unified decision endpoints (#52165) 2026-11-24 16:05:44 -08:00
test_routes_moderations.py fix(proxy): log each endpoint's own call type on failed audio, moderation, image, and rerank spend rows (#49684) 2026-11-02 23:57:11 +00:00
test_routes_onboarding.py
test_routes_queue.py fix(proxy): run baggage tag mappings and budget checks on /queue/chat/completions (#51753) 2026-11-14 08:54:54 -05:00
test_routes_threads.py fix(proxy): keep the mapped status on assistants and threads route errors (#44994) 2026-10-09 16:55:15 -07:00
test_routes_utils.py refactor(rust_bridge): route every Rust-to-Python call through host modules (#50822) 2026-11-11 01:57:54 +00:00
test_spend_counters.py fix(proxy): write a cold spend counter's cached spend once (#52806) 2026-11-24 13:00:34 -08:00
test_spend_counters_ledger.py test(proxy): give the spend counter ledger test's auth cache double the team fields read (#53958) 2026-11-23 23:37:56 +00:00
test_streaming_helpers.py fix(proxy): send finish_reason null on every in-progress streamed chat chunk (#53876) 2026-11-26 08:08:44 +00:00
test_team_model_name_translation.py fix(proxy)!: price expanded wildcard /model/info rows as the model their calls route to (#49128) 2026-11-08 19:08:22 +00:00