feat(dashboard): tool-stats model breakdown + Apr 18 anomaly viz#133
Merged
Merged
Conversation
…on (#6048)
Existing /api/tool-stats returned by_date + by_project time-series; this
card asked for a model breakdown so the April 18 zero-search anomaly is
visible alongside per-model usage. Extends the endpoint without breaking
the existing /agentic chart's response contract.
Backend (dashboard/app.py):
- Add `by_model` time-series (DATE × COALESCE(model, 'unknown')) and a
`models` de-duplicated list, parallel to the existing by_project /
projects pair.
- Optional `model` query param scopes all three series to a single model.
- All filters parameter-bound; brain.db opened read-only (uri mode).
Frontend (dashboard/frontend/src/{types.ts,components/AgenticDashboard.tsx}):
- `ToolStatsResponse` extended with `by_model: ToolStatsByModel[]` and
`models: string[]`.
- `ToolView` type extended with `'by-model'`; new memoized `modelChartData`
pivots by_model into a Recharts-friendly shape; new "By Model" button
and chart rendering mirror the existing "By Project" pattern.
Tests (tests/test_dashboard_tool_stats.py):
- 7 cases. Default shape, model filter scoping, unknown-tool empty
response, days clamping (0/365), and a regression test for the card's
motivating use-case: Apr 18 2026 WebSearch count == 0 in the by_date
series.
Closes #6048.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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
/api/tool-statswith aby_modeltime-series (andmodelslist) parallel to the existingby_project/projects. Optionalmodelquery param scopes all three series.by_dateandby_projectshapes are unchanged. Existing/agenticchart continues to work.AgenticDashboard.tsx, alongside "All Projects" and "By Project".Code reviewer flagged two LOW issues in the first pass (weak substring assertion, cross-series scope not tested); both addressed and re-reviewed PASS.
Test plan
Related