Skip to content

feat: History — store system snapshots in SQLite and show usage trends #14

@chojuninengu

Description

@chojuninengu

Summary

Store periodic system snapshots in a local SQLite database and expose a
History tab showing CPU, RAM, and disk usage trends over hours and days.
Answers the question: "why was my machine slow yesterday at 3pm?"

Why

This transforms Sysora from a real-time monitor into a proper observability
tool. No other lightweight tray app in this space does historical tracking.
This is the feature that makes power users recommend Sysora to others.

Scope

Rust backend

  • Add rusqlite crate:
  rusqlite = { version = "0.31", features = ["bundled"] }
  • Create database at app data dir on first launch:
  CREATE TABLE snapshots (
    id        INTEGER PRIMARY KEY,
    ts        INTEGER NOT NULL,  -- unix timestamp
    cpu_pct   REAL,
    ram_used  INTEGER,
    ram_total INTEGER,
    disk_used INTEGER,
    disk_total INTEGER,
    cpu_temp  REAL
  );
  • Write one snapshot per minute to the database (separate from the 3s UI refresh)
  • Auto-prune records older than 30 days to keep DB size small
  • Add Tauri commands:
    • get_history(hours: u32) -> Vec<SnapPoint> — last N hours of data
    • clear_history() — wipe all stored data
    • get_db_size() -> u64 — show user how much space the DB uses

Frontend

  • Add "History" tab to sidebar under Monitor section
  • Time range selector: Last 1h / 6h / 24h / 7d
  • Area chart (Recharts) with three lines: CPU %, RAM %, Disk %
    • X axis: time
    • Y axis: 0–100%
    • Tooltips showing exact values at each point
  • Summary cards: peak CPU, peak RAM, average CPU, average RAM for selected range
  • "Clear history" button in Settings tab
  • Show DB size in Settings ("History is using 2.4 MB")

Acceptance criteria

  • Snapshots stored every 60 seconds automatically
  • History tab shows data for last 1h, 6h, 24h, 7d
  • Charts render correctly with gaps if app was closed
  • DB auto-prunes after 30 days
  • Clear history works and confirms with a dialog
  • DB size shown in Settings

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions