feat(stats): expose root-filesystem disk usage in stats RPC and UI #15

Merged
mahmoud merged 2 commits from development_disk_stats_and_caps into development 2026-04-27 17:08:46 +00:00
Owner

What

Adds disk_total_gb / disk_used_gb / disk_pct to the Node KVS record and the stats RPC response, computed every 30 s from sysinfo's Disks API (picks the disk mounted on /, falls back to the largest disk if no / is reported). The UI sidebar gains a Disk gauge widget next to Memory and CPU; the per-node detail table gains Disk rows.

Files

  • crates/hero_codescalers_server/src/model/node.rs — three new fields on Node, #[serde(default)] so pre-existing KVS records still deserialize.
  • crates/hero_codescalers_server/src/main.rsroot_disk_usage() helper + extended node_update_stats() signature; the periodic stats updater task now refreshes disks too.
  • crates/hero_codescalers_server/openrpc.json — documents the new fields on the stats result.
  • crates/hero_codescalers_ui/templates/index.html + static/js/dashboard.js — Disk widget + sparkline, plus disk rows in the node-detail table.

Verified

Live on kristof4: disk_total_gb=948.62, disk_used_gb=107.39, disk_pct=11.32. RPC + UI both render correctly.

Notes

  • Backward-compatible: #[serde(default)] on the new fields means existing Node records still parse — they just report 0.0 until the next 30 s refresh fires.
  • The updater follows the existing pattern: round to 2 decimals, swallow errors with tracing::warn!.
## What Adds `disk_total_gb` / `disk_used_gb` / `disk_pct` to the `Node` KVS record and the `stats` RPC response, computed every 30 s from sysinfo's `Disks` API (picks the disk mounted on `/`, falls back to the largest disk if no `/` is reported). The UI sidebar gains a Disk gauge widget next to Memory and CPU; the per-node detail table gains Disk rows. ## Files - `crates/hero_codescalers_server/src/model/node.rs` — three new fields on `Node`, `#[serde(default)]` so pre-existing KVS records still deserialize. - `crates/hero_codescalers_server/src/main.rs` — `root_disk_usage()` helper + extended `node_update_stats()` signature; the periodic stats updater task now refreshes disks too. - `crates/hero_codescalers_server/openrpc.json` — documents the new fields on the `stats` result. - `crates/hero_codescalers_ui/templates/index.html` + `static/js/dashboard.js` — Disk widget + sparkline, plus disk rows in the node-detail table. ## Verified Live on kristof4: `disk_total_gb=948.62`, `disk_used_gb=107.39`, `disk_pct=11.32`. RPC + UI both render correctly. ## Notes - Backward-compatible: `#[serde(default)]` on the new fields means existing `Node` records still parse — they just report 0.0 until the next 30 s refresh fires. - The updater follows the existing pattern: round to 2 decimals, swallow errors with `tracing::warn!`.
Adds disk_total_gb / disk_used_gb / disk_pct to the Node KVS record and
the stats RPC response, computed every 30 s from sysinfo's Disks API
(picking the disk mounted on /). The UI sidebar gains a Disk gauge widget
next to Memory and CPU; the per-node detail table gains Disk rows.

- model/node.rs: three new fields on Node, with #[serde(default)] so
  pre-existing KVS records still deserialize.
- main.rs: root_disk_usage() helper picks the / disk (falls back to the
  largest disk if no / is reported), used by the stats updater task.
- openrpc.json: documents the new fields on the stats result.
- index.html + dashboard.js: Disk widget + sparkline, plus disk rows in
  the node-detail table.
mahmoud merged commit c0d4ef6d2b into development 2026-04-27 17:08:46 +00:00
mahmoud deleted branch development_disk_stats_and_caps 2026-04-27 17:08:50 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_codescalers!15
No description provided.