litellm/tests/test_litellm/proxy/utils/prisma_and_spend
devin-ai-integration[bot] 6e7984e537
fix(proxy): requeue spend logs when the DB write fails with a transport error (#36716)
* fix(proxy): requeue spend logs when the DB write fails with a transport error

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): hardcode the spend log queue cap and drop the stale re-export

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* refactor(proxy): keep the spend log requeue within the type discipline budget

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): apply the spend log queue cap to producer appends too

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): lower the spend log queue cap to 1k and make it env configurable

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): bound the spend log queue by bytes instead of row count

A row cap cannot bound memory: a row carries the whole prompt under store_prompts_in_spend_logs, so a cap that rides out an outage of counter-only rows is an OOM once prompts are stored. Every enqueue and dequeue now goes through one pair that tracks what the queue costs and drops the oldest rows past a 64 MB budget.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): make the spend log queue byte budget env configurable

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): use a string default for the spend log queue byte budget env read

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): make the spend log queue byte total a public attribute

The queue it accounts for is already public, and a private name only bought reportPrivateUsage errors at every call site.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: shivam <shivam@berri.ai>
2026-08-14 20:49:45 -07:00
..
__init__.py test(proxy/utils): pin PrismaClient and spend-update behavior (#29488) 2026-06-02 17:45:28 -07:00
_harness_smoke_test.py test(proxy/utils): pin PrismaClient and spend-update behavior (#29488) 2026-06-02 17:45:28 -07:00
conftest.py fix(spend): stop losing spend log rows when a flush is cancelled (#34826) 2026-08-12 20:10:50 -07:00
test_cache_user_row.py test(proxy/utils): pin PrismaClient and spend-update behavior (#29488) 2026-06-02 17:45:28 -07:00
test_config_param_cache.py test(proxy/utils): pin PrismaClient and spend-update behavior (#29488) 2026-06-02 17:45:28 -07:00
test_password_helpers.py test(proxy/utils): pin PrismaClient and spend-update behavior (#29488) 2026-06-02 17:45:28 -07:00
test_prisma_client_engine_watcher.py fix(proxy): recover Prisma DB reconnect loop when client is disconnected 2026-07-07 09:50:27 +03:00
test_prisma_client_get_data.py fix(proxy): force prisma recreate on postgres cached-plan error (#36428) 2026-08-14 15:04:01 -07:00
test_prisma_client_health.py test(proxy/utils): pin PrismaClient and spend-update behavior (#29488) 2026-06-02 17:45:28 -07:00
test_prisma_client_lifecycle.py test(proxy/utils): pin PrismaClient and spend-update behavior (#29488) 2026-06-02 17:45:28 -07:00
test_prisma_client_reconnect.py fix(proxy): force prisma recreate on postgres cached-plan error (#36428) 2026-08-14 15:04:01 -07:00
test_prisma_client_writes.py fix(proxy): never log raw virtual keys in key insertion debug output (#33268) 2026-07-14 16:32:26 -07:00
test_proxy_update_spend.py fix(proxy): requeue spend logs when the DB write fails with a transport error (#36716) 2026-08-14 20:49:45 -07:00
test_send_email.py fix(proxy): support SMTP implicit SSL (port 465) (#30395) 2026-06-13 14:34:43 -07:00
test_spend_functions.py fix(spend): stop losing spend log rows when a flush is cancelled (#34826) 2026-08-12 20:10:50 -07:00