Repository navigation
revert: "perf(proxy): split aggregated usage query into key-free rollups and bounded top-N keys (#41293)" - #43596
Conversation
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
8449006 to
ceede67
Compare
b8a9b52 to
52c2990
Compare
|
@greptileai review |
3a63c86 to
0b489ce
Compare
a37e67e to
3c4cc18
Compare
…_aggregate_split"
0b489ce to
4a71348
Compare
3c4cc18 to
17c22bc
Compare
…r the usage dashboard (#41324)" (#43595) * Revert "Merge pull request #41324 from BerriAI/litellm_daily_global_spend_table" * Revert "Merge pull request #41293 from BerriAI/litellm_usage_key_free_aggregate_split" (#43596) Co-authored-by: yassin <yassin@berri.ai> --------- Co-authored-by: yassin <yassin@berri.ai> Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…)" (#43378) * Revert "feat(usage): search keys beyond the top-N usage subset (#42827)" * revert: "feat(proxy): add LiteLLM_DailyGlobalSpend key-free rollup for the usage dashboard (#41324)" (#43595) * Revert "Merge pull request #41324 from BerriAI/litellm_daily_global_spend_table" * Revert "Merge pull request #41293 from BerriAI/litellm_usage_key_free_aggregate_split" (#43596) Co-authored-by: yassin <yassin@berri.ai> --------- Co-authored-by: yassin <yassin@berri.ai> Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…sage view (#42857)" (#43377) * Revert "feat(usage): search team keys beyond the top-N in the Team usage view (#42857)" * revert: "feat(usage): search keys beyond the top-N usage subset (#42827)" (#43378) * Revert "feat(usage): search keys beyond the top-N usage subset (#42827)" * revert: "feat(proxy): add LiteLLM_DailyGlobalSpend key-free rollup for the usage dashboard (#41324)" (#43595) * Revert "Merge pull request #41324 from BerriAI/litellm_daily_global_spend_table" * Revert "Merge pull request #41293 from BerriAI/litellm_usage_key_free_aggregate_split" (#43596) Co-authored-by: yassin <yassin@berri.ai> --------- Co-authored-by: yassin <yassin@berri.ai> Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Reverts #41293
TLDR
Problem this solves:
How it solves it:
git revert -m 1 2e46b10320, conflicts resolved by hand against today's mainUSAGE_TOP_API_KEYS_LIMIT, the key-free aggregate split and the top-N key queryapi_key_limit/total_api_keysfrom the response and the dashboard truncation noticeIntentional product change: the Usage page loads every key again instead of the 100 highest-spend keys, so the "Only the 100 highest-spend keys of N are loaded" notice and the export block tied to it are gone
User Flow
Before: an admin with 105 keys in one team only sees 100 of them on the Usage page
api_key_limit: 100,total_api_keys: 105and 100 keysAfter: the same admin sees all 105 keys and no truncation notice
api_key_limitortotal_api_keysfieldsPre-Submission checklist
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or moreScreenshots / Proof of Fix
Postgres, one proxy on localhost:4000 with a single
openai/gpt-5.4-minideployment, one teamqa-topn-teamwith 105 virtual keys owned byqa-topn-user, each key sending one realPOST /v1/chat/completionsto OpenAIThe QA below ran at ceede67 and 52c2990. The current head 17c22bc carries the same patch (identical
git patch-id), re-squashed on newer mainBefore (ceede67)
User aggregated activity
curl -s "localhost:4000/user/daily/activity/aggregated?start_date=2026-09-28&end_date=2026-09-28&user_id=qa-topn-user" -H "Authorization: Bearer $MASTER_KEY"api_key_limit: 100andtotal_api_keys: 105,total_api_requests: 212, andbreakdown.api_keyshas 100 entriesTeam aggregated activity
curl -s "localhost:4000/team/daily/activity/aggregated?start_date=2026-09-28&end_date=2026-09-28&team_ids=qa-topn-team" -H "Authorization: Bearer $MASTER_KEY"api_key_limit: 100andtotal_api_keys: 105,total_api_requests: 212, andbreakdown.api_keyshas 100 entriesUsage page
After (52c2990)
User aggregated activity
api_key_limitortotal_api_keys,total_api_requests: 213, andbreakdown.api_keyshas 105 entriesTeam aggregated activity
api_key_limitortotal_api_keys,total_api_requests: 213, andbreakdown.api_keyshas 105 entriesUsage page
Type
Refactoring
Caveats (if any)
Medium
Low
Link to Devin session: https://app.devin.ai/sessions/7097c700d7fc4601961a6013b1adcec7
Open in Devin Desktop: https://app.devin.ai/desktop/session/7097c700d7fc4601961a6013b1adcec7?variant=devin
Requested by: @yassin-berriai