Repository navigation
feat(dashboard): every token meter shows the total of all four parts - #108
Merged
Merged
Conversation
… with the parts, cache hit rate and split by feature
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
Every token meter now shows the total of all four parts: new input, read from cache, written to cache and output. Before, the meters showed new input plus output only, which left out most of the tokens actually used (cache reads and writes). No money appears on any of these views.
Works with the gateway from CoderHelm/coderhelm-platform#166. Against an older gateway with no cache fields, the meters fall back to its own total.
Changes
lib/usage.ts:usageParts,usageTotal,cacheHitRate,usageBreakdown, feature labels.lib/api.ts:UsageInfoadds the cache parts, hit rate, the counted number, the flag, and features.client-shell.tsx,settings/use-settings-status.ts,settings/page.tsx,settings/budget/page.tsx,runs/detail/page.tsx,analytics/page.tsx.Verification
eslint .(0 errors),tsc --noEmit,next buildfor the dashboard.e2e/settings.spec.ts+e2e/audit-shell.spec.ts: 44 passed. The new test checks that the sidebar meter shows71.3M / 200M(the total of all four parts, not1.1Mfor input plus output) and that its hover lists the four parts and the hit rate. It also checks the hub row, that the page's four parts add up to the API's total, the hit rate, the split by feature, no$on the page, and no sideways scrolling at 375px.