feat(usage): per-model and per-day prefix-cache hit-rate observability#165
Open
OnlyTerp wants to merge 3 commits into
Open
feat(usage): per-model and per-day prefix-cache hit-rate observability#165OnlyTerp wants to merge 3 commits into
OnlyTerp wants to merge 3 commits into
Conversation
Add per-day cache hit-rate readout below each bar in the daily usage chart (when data is present), and an average cache hit-rate summary stat alongside the existing total tokens/requests/peak day row. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Surface prefix-cache hit-rate in the usage dashboard, per model and per day. The aggregate already records
cache_read/cache_writetokens; this exposes them in the breakdowns and UI.Why (local-model)
Lets you see whether local prefix caching is actually helping — e.g. after the tool-order normalization PR — and how the hit rate trends over time. Inference-efficiency signal, not API cost.
Changes
controller/src/stores/inference-request-store.ts: addcache_read/cache_write/cache_hit_rateto theby_model,daily, anddaily_by_modelbreakdowns; extract a sharedcalcCacheHitRate(also used by the global hit-rate).controller/src/modules/system/usage/pi-sessions.ts: per-model / per-day cache accumulation in the parallel Pi-sessions aggregator.shared/contracts/usage.ts+ frontend normalizer: additive cache fields (default 0).Verification
cd controller && bun test src/stores/inference-request-store.test.ts→ pass;bun run typecheck→ clean.typecheck+lint+build→ clean.Non-goals