Context
tokenUsageSection in DiscoverView.kt currently renders a horizontal bar chart of
the top 5 models by all-time token usage, sourced directly from
TelemetryMetrics.llmTokensByInstance (a flat in-memory/file-backed map).
With Issue 1 landing (SQLite persistence + LlmUsageRepository), we can query
time-scoped data. This ticket covers enhancing the section to surface that richer data.
Current Behaviour
- All-time total shown in section header (
discover.tokens.total)
- Top-5 bar chart with provider/model label, fill bar, abbreviated token count, and %
- Empty state if
totalTokensUsed == 0
- "Open in new" icon navigates to System Diagnostics
Proposed Enhancements
1. Time-scope selector (This Month / This Week / All Time)
Add a compact segmented control or chip row below the section title to switch between:
- This Month (default)
- This Week
- All Time
-
Summary stat row above the bar chart
Inside the Surface card, before the bar rows, add a compact 3-column stat strip:
Tokens used. Calls made Avg tokens/call
45.2K 38. 1.2K
All values scoped to the active time period. Uses abbreviateTokens() (already exists) and LocalizationManager.formatNumber().
-
tokenBarRow — add call count column
Extend the existing tokenBarRow composable with an additional calls: Int column to the right of the % label, so each row shows:
[model/provider] [====bar====] [45.2K] [62%] [38 calls]
- Empty state - scope-aware copy
Currently the empty state shows a single string (discover.tokens.empty). Update to show a scope-aware message, e.g.:
"No token usage recorded this month"
"No token usage recorded this week"
"No token usage recorded yet"
Depends on #603
Context
tokenUsageSectioninDiscoverView.ktcurrently renders a horizontal bar chart ofthe top 5 models by all-time token usage, sourced directly from
TelemetryMetrics.llmTokensByInstance(a flat in-memory/file-backed map).With Issue 1 landing (SQLite persistence +
LlmUsageRepository), we can querytime-scoped data. This ticket covers enhancing the section to surface that richer data.
Current Behaviour
discover.tokens.total)totalTokensUsed == 0Proposed Enhancements
1. Time-scope selector (This Month / This Week / All Time)
Add a compact segmented control or chip row below the section title to switch between:
Summary stat row above the bar chart
Inside the Surface card, before the bar rows, add a compact 3-column stat strip:
Tokens used. Calls made Avg tokens/call
45.2K 38. 1.2K
All values scoped to the active time period. Uses abbreviateTokens() (already exists) and LocalizationManager.formatNumber().
tokenBarRow — add call count column
Extend the existing tokenBarRow composable with an additional calls: Int column to the right of the % label, so each row shows:
[model/provider] [====bar====] [45.2K] [62%] [38 calls]
Currently the empty state shows a single string (discover.tokens.empty). Update to show a scope-aware message, e.g.:
"No token usage recorded this month"
"No token usage recorded this week"
"No token usage recorded yet"
Depends on #603