Skip to content

Add dashboard enhancements: session history, budget gauges, latency, token charts, blocked keys UI#17

Merged
DanialBeg merged 4 commits intomainfrom
feat/dashboard-enhancements
Mar 26, 2026
Merged

Add dashboard enhancements: session history, budget gauges, latency, token charts, blocked keys UI#17
DanialBeg merged 4 commits intomainfrom
feat/dashboard-enhancements

Conversation

@DanialBeg
Copy link
Copy Markdown
Member

@DanialBeg DanialBeg commented Mar 26, 2026

Summary

  • Agent & model charts: Horizontal bar charts showing top 10 agents and models by cost (7d), using existing /api/dashboard/costs endpoint
  • Session history: Tab-based view (Active / 24h / 7d) with new QueryRecentSessions Ledger method, plus task, tokens, and duration columns
  • Session anomaly highlighting: Red left border on sessions with cost or call count >3x the mean
  • Budget status gauges: New GET /api/admin/budgets/status endpoint with progress bar UI (green/yellow/red at 70%/90%)
  • Latency percentiles: New QueryLatencyPercentiles Ledger method (Go-computed for SQLite, native PERCENTILE_CONT for Postgres), P50/P90/P99 stat cards, and histogram chart
  • Token timeseries: New QueryTokenTimeseries Ledger method with stacked area chart and Cost/Tokens tab toggle
  • Blocked keys UI: Table + add/remove form wired to existing admin endpoints
  • Sticky table headers for all scrollable tables
  • Min-height on grid panels to prevent empty-state collapse

15 files changed, +1313 / -32 lines across backend (Ledger interface, SQLite, Postgres, handlers) and frontend (HTML, JS, CSS).

Test plan

  • All existing tests pass with race detection
  • Linter passes (0 issues)
  • Pre-commit hooks pass (fmt, vet, lint, test)
  • New tests for session history, latency, and token timeseries endpoints
  • New test for budget status endpoint
  • Visual verification: open http://localhost:8787 and confirm all new panels render
  • Verify session tab switching between Active/24h/7d
  • Verify Cost/Tokens tab toggle on timeseries chart
  • Verify blocked keys add/remove works with admin token

Addresses all actionable findings from pre-release security audit:

CRITICAL: Timing-safe admin token comparison (crypto/subtle)
HIGH: Bound request (10MB) and response (50MB) bodies in proxy,
      sanitize error messages in proxy/admin/dashboard handlers,
      add structured logger to admin and dashboard handlers
MEDIUM: Rate limiter cleanup goroutine, agent session max cap (10K)
        with LRU eviction, budget cache eviction + RWMutex race fix,
        MCP path traversal sanitization, CDN SRI hash, CORS middleware,
        CSRF protection via X-Requested-With header, TLS support
LOW: Demo config token warning

Skipped: L1 key fingerprinting (known trade-off), L2 filepath.Match
wildcards (admin-only), L4 Prometheus unauthenticated (standard).
…gent/model charts, latency percentiles, token timeseries, blocked keys UI

Backend:
- Add QueryRecentSessions, QueryLatencyPercentiles, QueryTokenTimeseries to Ledger interface
- Implement for both SQLite (Go-computed percentiles) and PostgreSQL (native PERCENTILE_CONT)
- Add SessionRecord, LatencyStats, LatencyBucket, TokenTimeseriesPoint model structs
- Add 3 new dashboard endpoints: /sessions/history, /latency, /timeseries/tokens
- Add budget status endpoint: GET /api/admin/budgets/status with utilization data

Frontend:
- Agent cost leaderboard and model usage horizontal bar charts
- Session tabs (Active / Recent 24h / Recent 7d) with task, tokens, duration columns
- Session anomaly highlighting (>3x mean cost/calls gets red border)
- Latency P50/P90/P99 stat cards and histogram distribution chart
- Token timeseries stacked area chart with Cost/Tokens tab toggle
- Budget status progress bars with green/yellow/red color coding
- Blocked keys table with add/remove UI
- Sticky table headers for scrollable tables
- Min-height on grid panels to prevent empty-state collapse
@DanialBeg DanialBeg self-assigned this Mar 26, 2026
The new QueryTokenTimeseries method pushed "minute" and "day" string
occurrences to 4, triggering goconst in CI.
Integrates the SVG logo (octopus with bar chart body) into the
dashboard header as a 32px inline mark with blue-accented wordmark,
and into the docs hero section as a 64px mark replacing the old
"AL" text badge. Adds SVG favicons to both sites.
@DanialBeg DanialBeg merged commit 7d0468f into main Mar 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant