Repository navigation
feat(ui): add cache hit/miss filter to Request Logs - #38432
yassin-berriai merged 4 commits into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
|
No action taken on #38432 — it has no labels at all, so the required |
Greptile SummaryThe PR adds cache hit/miss filtering to the Request Logs API and dashboard.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| litellm/proxy/spend_tracking/spend_management_endpoints.py | Adds allowlisted cache filtering with shared SQL predicates for count and data queries. |
| tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.py | Tests hit, miss, legacy/null, unfiltered, and invalid filter behavior. |
| ui/litellm-dashboard/src/components/view_logs/RequestLogsFilters.tsx | Adds the Cache selector using the existing filter drawer state flow. |
| ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx | Maps cache filter state to the backend query parameter. |
| ui/litellm-dashboard/src/components/networking.tsx | Extends request parameters with the cache filter while removing the previously flagged redundant comment. |
| ui/litellm-dashboard/src/lib/http/schema.d.ts | Reflects the new query parameter in the typed API schema. |
Reviews (3): Last reviewed commit: "chore(ui): drop redundant cache filter c..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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>
|
Removed in d57f2d8, thanks |
…ment_endpoints.py Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
TLDR
Problem this solves:
How it solves it:
cache_hit_filterquery param (hitormiss) on/spend/logs/ui, applied in SQLUser Flow
Before: an admin evaluating response caching cannot isolate cache hits in the dashboard
After: the same admin filters hits and misses directly in the dashboard
Relevant issues
Linear ticket
Resolves LIT-6260
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<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@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Shared setup: proxy on localhost:4000 with local response caching enabled and Postgres attached, then one real OpenAI call that misses the cache and an identical second call that hits it
The spend table then held two rows for the same completion id: the first with no cache state recorded, the second
_cache_hitrow with cache_hit TrueBefore (ecc4976)
cache_hit_filter=hit is ignored, both rows come back
curl -s -G "http://localhost:4000/spend/logs/ui" -H "Authorization: Bearer sk-1234" --data-urlencode "start_date=2026-08-26 23:46:37" --data-urlencode "end_date=2026-08-27 01:46:37" --data-urlencode "cache_hit_filter=hit"total: 2, both the cache-hit row and the miss row are returnedunknown filter value is silently accepted
cache_hit_filter=invalidAfter (d57f2d8)
cache_hit_filter=hit returns only the hit
cache_hit_filter=hitrequest as Beforetotal: 1, only the_cache_hitrow withcache_hit= Truecache_hit_filter=miss returns only the miss, including the legacy null row
cache_hit_filter=misstotal: 1, only the original row withcache_hit= Noneno filter still returns everything
cache_hit_filtertotal: 2invalid value is rejected
cache_hit_filter=invalid{"error":{"message":"Invalid cache_hit_filter: invalid. Must be one of: hit, miss","type":"bad_request","param":"cache_hit_filter","code":"400"}}UI check: open http://localhost:4000/ui/?page=logs, open Filters, pick Cache Hit in the new Cache dropdown and the table reloads with only cache hits; pick Cache Miss for the rest; pick All Requests to clear
Type
🆕 New Feature
Caveats (if any)
Low
Final Attestation
Link to Devin session: https://app.devin.ai/sessions/6a80c584983d45b09a8a49cfdcdcd47c
Requested by: @yassin-berriai