Skip to content

revert: "feat(proxy): add LiteLLM_DailyGlobalSpend key-free rollup for the usage dashboard (#41324)" - #43595

Merged
yuneng-berri merged 2 commits into
litellm_revert_42827from
litellm_revert_41324
Sep 28, 2026
Merged

yuneng-berri merged 2 commits into
litellm_revert_42827from
litellm_revert_41324

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Reverts #41324

TLDR

Problem this solves:

How it solves it:

  • git revert -m 1 87694c26ef, conflicts resolved by hand against today's main
  • Removes the hourly reconcile job, its scheduler hook, the reconciled-through marker and the global table reads
  • Keeps the LiteLLM_DailyGlobalSpend Prisma model and migration 20260915000000_add_daily_global_spend, so upgraded databases need no destructive migration

The follow-ups on the #41324 branch go with it: c8a2d8c, ad8de0e, 84c098d, 0601d2b, f25d659, abf530f, 3449ae9, 834313a. Later edits to the removed module from #42710 go too, since the file is deleted

User Flow

Before: the Usage page and the aggregated activity endpoints answer global totals partly from the rollup table for closed days

  1. The admin opens http://localhost:4000/ui/?page=usage with more than 100 keys in one team
  2. GET http://localhost:4000/user/daily/activity/aggregated and GET http://localhost:4000/team/daily/activity/aggregated return the day's totals and a key breakdown

After: the same page and endpoints return the same totals, read straight from the per-key daily spend

  1. The admin opens http://localhost:4000/ui/?page=usage with more than 100 keys in one team
  2. Both endpoints return the same totals as before; the top-N key cap is still here and goes away in the next PR

Pre-Submission checklist

  • The handful of test files covering my change pass locally, e.g. 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 more
  • My PR's scope is as isolated as possible; it only solves 1 specific problem

Screenshots / Proof of Fix

Postgres, one proxy on localhost:4000 with a single openai/gpt-5.4-mini deployment, one team qa-topn-team with 105 virtual keys owned by qa-topn-user, each key sending one real POST /v1/chat/completions to OpenAI

for k in $(cat keys.txt); do
  curl -s localhost:4000/v1/chat/completions -H "Authorization: Bearer $k" -H "Content-Type: application/json" \
    -d '{"model":"gpt-5.4-mini","messages":[{"role":"user","content":"say hi"}]}' -o /dev/null -w "%{http_code}\n"
done | sort | uniq -c

The QA below ran at 5aafae2 and ceede67. The current head 4a71348 carries the same patch (identical git patch-id), re-squashed on newer main

Before (5aafae2)

  1. 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" returns total_api_requests: 211, api_key_limit: 100, total_api_keys: 105 and 100 entries in breakdown.api_keys
  2. 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" returns the same numbers

After (ceede67)

  1. The same user curl returns total_api_requests: 212 (one more real chat request was sent right before this run), api_key_limit: 100, total_api_keys: 105 and 100 entries in breakdown.api_keys, the same shape as Before
  2. The same team curl returns the same numbers, and the proxy boots with no pending migrations and the kept LiteLLM_DailyGlobalSpend table in place

Type

Refactoring

Caveats (if any)

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

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@CLAassistant

CLAassistant commented Sep 28, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ devin-ai-integration[bot]
❌ yassin-berriai
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High risk] Removes a background job that rolls up spend data.

The PR appears safe to merge, though broad global usage queries retain the previously noted performance concern.

Findings

  1. P2 Broad usage queries become expensive ▶

Summary

The PR removes the daily global-spend reconciliation job and switches aggregated usage reads back to per-key daily spend, while retaining the database model and migration.

  • Removes rollup-specific constants, code, and tests.
  • Leaves the existing top-N key breakdown unchanged.

Reviews (2) · Last reviewed commit: "Revert "Merge pull request #41324 from B..."

Comment thread litellm/proxy/management_endpoints/common_daily_activity.py Outdated
@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai review

…_aggregate_split" (#43596)

Co-authored-by: yassin <yassin@berri.ai>
@yuneng-berri
yuneng-berri merged commit aece1ba into litellm_revert_42827 Sep 28, 2026
44 of 47 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_revert_41324 branch September 28, 2026 21:40
yuneng-berri pushed a commit that referenced this pull request Sep 28, 2026
…)" (#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>
yuneng-berri pushed a commit that referenced this pull request Sep 28, 2026
…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>

This branch is waiting to be deployed

1 waiting deployment
e2e-changed — 84e234c5 Waiting Sep 28, 2026 by yuneng-berri via oauth #1669
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants