Skip to content

[Epic] Persist valuable telemetry as time-series — stop discarding block / share-health / disk-growth / XvB / per-worker data #196

Description

@VijitSingh97

Data-capture audit + tracking epic. A review of the dashboard's persistence layer found we historize only a fraction of the telemetry we fetch — the rest is rendered live and thrown away. This epic tracks persisting the valuable, low-cost series we currently discard, so operators get trends (not just last-value) and history survives restarts/disconnects.

What's persisted today

Only three things become history in SQLite (build/dashboard/mining_dashboard/service/storage_service.py_create_tables):

Table Stores Cadence
history total / P2Pool / XvB hashrate 1 row / 30s poll
shares P2Pool share events (ts, difficulty) event-driven (#129)
kv_store a few XvB scalars + the entire latest_data dict as one snapshot_latest_data blob, overwritten every 30s per cycle (overwrite)

Everything else the data loop fetches survives only as last-value inside that overwritten snapshot → no trend, gaps lost.

Design principles (shared across all sub-items)

  • Dedicated small tables, not extra history columns — independent retention, and avoids multiplying history rows for per-worker/per-series data.
  • Retention + pruning mirroring HISTORY_RETENTION_SEC + the existing probabilistic prune (storage_service.py:240).
  • Cumulative counters (shares, blocks, proxy results) → store deltas/events, and detect a counter reset (proxy/p2pool restart → counter goes backwards) as a segment break, not a negative rate. Reuse the _shares_to_record pattern (data_service.py:176).
  • Throttle high-cardinality / slow-moving series (per-worker ~5 min, network hourly) rather than the 30 s loop rate.
  • Expose new series via /api/state; the actual charts/badges are tracked in the consuming feature issues (below).

Captures

Tier 1 — high value, negligible/low cost

Tier 2 — valuable, throttle to avoid bloat

Explicitly NOT captured as a series (would bloat / low value)

  • CPU% / RAM% / load average (collector/system.py) — high-frequency, low long-term value; keep as live gauges (hourly aggregates only if ever needed).
  • HugePages used/free — effectively static after boot; live gauge only.
  • Raw stratum passthrough JSON (get_stratum_stats) — large, redundant with the structured fields.
  • The full latest_data snapshot — correctly stays a single overwritten last-value blob.

Relationships

Milestone rationale

These captures back v1.1 trend/charting features (#116, #99, #104), and the v1.0 dashboard-accuracy issues (#169/#182) don't require persistence — so this epic is milestoned v1.1. Any individual slice can be pulled into v1.0 if a release-blocking issue comes to depend on it.

Acceptance criteria

Metadata

Metadata

Assignees

No one assigned

    Labels

    dashboardMining dashboard web UIenhancementNew feature or requestinfraDeployment, packaging, releases

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions