Commit Graph

4 Commits

Author SHA1 Message Date
nicolargo
04419de50a Correct display issue on start with all perCPU = 100% 2026-05-30 15:56:23 +02:00
nicolargo
4dbc015214 Correct display issue on start with CPU = 100% 2026-05-30 15:37:04 +02:00
nicolargo
656d902585 fix(v5): guard against psutil's no-baseline first cpu_times_percent sample
psutil.cpu_times_percent(interval=0.0) requires two anchor points to
compute a delta. Before the second anchor is laid down (~1 ms after the
first), it returns either all zeros or a partial sample like
(idle=1.0, every other field=0.0). The cpu plugin computes
total = 100 - idle, so an unsettled sample produces total=99-100% — a
visible spike that persists for one TTL window (1 s by default) after
startup, while v4 stays at the real value because CpuPercent primes
psutil in __init__.

Sampler-level fix: detect unsettled samples (sum of time-percent
fields < 50%), sleep 50 ms, and re-sample once before caching. The
guard runs inside the asyncio lock so concurrent get_aggregate calls
share the same retry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 16:00:57 +02:00
nicolargo
f443d8ae05 Implement CPU plugin v5 - Add normalize_by option to normalise a limit by another field (ex: load and ctx switch) 2026-05-06 18:30:50 +02:00