Add advanced container stats tab with timeframes and I/O charts.
Release rolling / release (push) Has been cancelled

Expand server history samples with network/block rates and longer
retention, and rebuild the details Stats tab with live KPIs, 1m–30m
windows, auto-scale, pause, CSV export, and CPU/memory/net/disk charts.
This commit is contained in:
Raven Scott
2026-07-13 18:13:27 -04:00
parent 270b38af15
commit b2e04caabc
8 changed files with 1216 additions and 262 deletions
+38
View File
@@ -4,6 +4,7 @@ import {
getHistory,
pruneMissing,
clearHistory,
maxHistoryPoints,
} from '../server/services/stats-history.js'
test('stats history ring buffer', (t) => {
@@ -18,3 +19,40 @@ test('stats history ring buffer', (t) => {
pruneMissing([])
t.is(getHistory(id).length, 0)
})
test('stats history stores io rates and supports since filter', (t) => {
clearHistory()
const id = 'io1'
const t0 = Date.now() - 10_000
// inject samples with forced timestamps via direct map is not exported;
// recordSample uses Date.now() — filter by since slightly in the past
recordSample(id, {
cpu: 1,
memory: 100,
memoryLimit: 1000,
netRxRate: 10,
netTxRate: 20,
blkReadRate: 30,
blkWriteRate: 40,
})
recordSample(id, {
cpu: 2,
memory: 200,
netRxRate: 11,
netTxRate: 21,
blkReadRate: 31,
blkWriteRate: 41,
})
const all = getHistory(id)
t.is(all.length, 2)
t.is(all[0].netRxRate, 10)
t.is(all[1].blkWriteRate, 41)
t.ok(all[0].memoryLimit === 1000 || all[0].memoryLimit === 0)
const future = getHistory(id, { since: Date.now() + 60_000 })
t.is(future.length, 0)
const recent = getHistory(id, { since: t0 })
t.is(recent.length, 2)
t.ok(maxHistoryPoints() >= 120)
})