Buffered reports can arrive milliseconds apart even though their counters
were collected seconds apart. Measure sequenced agent counter intervals on
their collection clocks while retaining receipt-time freshness and history.
Carry the optional host IO counter timestamp through collection and reports,
use libvirt inventory time for CPU and IO, rebase incomparable clocks, and
omit unknown Docker network history. Preserve unsigned libvirt CPU counters
and legacy report compatibility. Register the counter, wire and producer
regressions under the existing subsystem proof routes.
Proxmox reports cumulative byte counters that update unevenly across
polling intervals, causing a steady 100 Mbps download to appear as
spikes up to 450 Mbps in sparkline charts. Replace per-interval rate
calculation with a 4-sample sliding window (30s at 10s polling) that
averages over the full span — the same approach Prometheus rate() uses.
MetricsHistory.Cleanup() was defined but never called, and even if called,
it only removed old data points without deleting map entries for deleted
containers/VMs. Each stale entry leaked ~224KB (7 pre-allocated slices).
Changes:
- Call metricsHistory.Cleanup() and rateTracker.Cleanup() in maintenance loop
- Delete map entries entirely when all data points have expired
- Return nil instead of empty slice in cleanupMetrics() to release backing arrays
- Add Cleanup() method to RateTracker with 24-hour stale threshold
- Add debug logging to track cleanup activity
Related to #1153