mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-06 08:16:43 +00:00
* feat(ui): chart failed requests as their own series on the cache dashboard Spend logs for failed requests are stored with an empty call_type, so the Cache Hits vs API Requests chart lumped them into an Unknown bar that read as normal LLM API traffic. The activity query now also returns a per-group failed_rows count (status = 'failure') and the dashboard charts it as a third stacked series, so failures are visibly separate from successful requests and cache hits. The chart data transform moves into a pure summarizeCacheActivity helper with unit tests; header stats keep their existing semantics (cache hit ratio still counts failures in the denominator). * refactor(ui): move cache dashboard aggregation server-side with a typed response The /global/activity/cache_hits endpoint previously returned raw per (key, call_type, model) spend-log aggregates typed as LiteLLM_SpendLogs (wrong), and the dashboard reduced them in the browser: grouping by call_type, relabeling empty call_type as Unknown, and computing the stat card totals. All of that now happens server-side. The SQL groups per call_type and splits cache hits vs successful vs failed requests, a new cache_activity module validates rows into Pydantic models and computes totals plus the key-alias/model filter options, and the endpoint declares a real response_model so schema.d.ts types it correctly. The dashboard consumes it through a typed $api react-query hook (filters ride the query key and are applied in SQL instead of the browser), the hand-rolled summarizeCacheActivity transform and the adminGlobalCacheActivity fetch helper are deleted, and the refresh button now actually refetches. The endpoint is UI-internal (hidden from the public swagger), so the response reshape is not a public API break. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_analytics_endpoints.py | ||