T-37: add aggregated historical OMP stats via omp-stats - #112
Merged
Conversation
- New GET /api/usage/stats endpoint filterable by workspace (cwd), model, agentType, and range (1h|24h|7d|30d|90d|all). - Backed by @oh-my-pi/omp-stats SQLite DB: syncAllSessions() runs single-flight in background (default worker pool, never blocks the server); getDashboardStats() ensures initDb() on first request. - Custom combined WHERE-clause queries on messages table for cross- dimensional filtering (byModel/byWorkspace/byAgentType in one pass). - Session drill-down links resolved server-side via bridge.listSessions() path map; ancestor walk handles subagents/advisors at any depth. No raw filesystem paths sent to the client. - source: 'sessions' label explicit in wire format; routine_runs excluded (satisfies 'not mixed without explicit labeling'). - New protocol types: OmpStatsRange, SessionDrillDownLink, HistoricalModelStats, HistoricalWorkspaceStats, HistoricalAgentTypeStats, AggregatedStatsResponse. - AggregatedStatsSection added to SubscriptionLimitsView: range picker, workspace/model/agentType filters, byModel table with expandable session link chips, byWorkspace and byAgentType tables. - 17 unit tests (computeCutoff, resolveParentSessionPath, resolveDeckSession including deep-nested advisor case).
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.
Adds a filterable historical stats dashboard backed by @oh-my-pi/omp-stats.
Changes
Tests
Session: auto-work T-37