Historical metrics + sparkline charts #10
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Retain a rolling window of metric snapshots (e.g. 24h at 1-5 min resolution) and render small sparkline charts per host card instead of just the current value.
Starting this one. SQLite already retains 24h of snapshots (
metric_snapshots), just unused by the UI so far. Plan: a windowed query for the last ~40 samples per host, embedded in the existing/api/hostsresponse (avoids N+1 requests given the polling model already in place), rendered as small hand-rolled SVG sparklines in each host card — no charting library needed at this scale.Done and deployed.
/api/hostsnow embeds the last ~40 samples per host (one windowed query viaROW_NUMBER() OVER (PARTITION BY host_id ...), not N+1), rendered as small hand-rolled SVG sparklines (cpu/mem/disk overlaid) in each host card.Also found and fixed a real pre-existing bug while checking the sparkline data: the Proxmox host node's own mem/disk had been
nullthis entire time./nodes/{node}/statusnestsmemory: {total, used}/rootfs: {total, used}, but the code assumed the same flatmem/maxmem/disk/maxdiskshape the LXC listing endpoint uses — producedNaN, which serializes asnullover JSON instead of throwing, so it went unnoticed. LXC entries were never affected (different endpoint, correct shape). Fixed and verified against raw Proxmox API values (68% mem / 3.5% disk, matches).