Skip to content

feat: dashboard trend sparklines + history time-series - #4

Merged
Jamkris merged 1 commit into
mainfrom
feat/dashboard-history
Jul 10, 2026
Merged

feat: dashboard trend sparklines + history time-series#4
Jamkris merged 1 commit into
mainfrom
feat/dashboard-history

Conversation

@Jamkris

@Jamkris Jamkris commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

Records dashboard counters over time and shows lightweight trend sparklines on the home page.

  • New bastion/history.py: append-only JSONL time-series under the data dir, capped at ~24h (auto-trim). Best-effort IO, never raises.
  • The background poller records a snapshot each cycle (independent of alerts).
  • Pure sparkline_points() renders an inline SVG polyline server-side — no charting library / CDN.
  • Home shows banned + attacker sparklines (last ~hour). New GET /api/history?limit=N.

Test plan

  • python -m pytest -q → 125 passed. New: tests/test_history.py, sparkline cases in tests/test_util.py, poller/web integration tests.
  • data/history.jsonl is gitignored.

Summary by cubic

Adds trend sparklines to the home page for banned IPs and attackers. A new capped JSONL history records counters and powers a simple history API.

  • New Features
    • Append-only JSONL time-series of dashboard counters, capped at ~24h; best-effort IO.
    • Server-rendered SVG sparklines (no charting library) on the home page using recent samples (~last hour).
    • New GET /api/history?limit=N returning recorded points for external use.

Written for commit b230a2f. Summary will update on new commits.

Review in cubic

@Jamkris
Jamkris merged commit ae1e9cc into main Jul 10, 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