fix: normalize CPU % against container cpuLimit and add soft ceiling to BarChart#4464
fix: normalize CPU % against container cpuLimit and add soft ceiling to BarChart#4464
Conversation
ReviewCPU normalization fix - Correct. calculateCPUPercentUnix multiplies by onlineCPUs, so a container with --cpus=2 at full utilization reports 200% raw. The old return 1 divided by 1, overcapping at 100%. Dividing by cpuLimit (2.0) gives correct 100%. Fix is consistent across all three files. BarChart soft ceiling - Improvement for relative scaling, but one behavioral note:
No bugs, no security concerns. The CPU normalization is the substantive fix here. |
ecf748d to
f236f59
Compare
|
CPU fix ( Potential issue - BarChart Behavior change to flag: Minor:
No bugs or security issues. The CPU normalization fix is the main correctness improvement. |
…to BarChart CPU normalization was dividing by 1 when a container had a CPU limit set, instead of dividing by the actual limit. A --cpus=2 container at 150% now correctly shows 75% instead of being capped at 100%. BarChart now uses a soft ceiling (max(dataMax * 1.2, 10)) so idle containers stay visually flat instead of filling the full chart height. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
62c008b to
ee4bad5
Compare
Follow-up ReviewImplementation looks correct end-to-end after reading the full
One minor note: Overall: the CPU normalization fix is correct and the mode toggle is well-implemented. No blockers. |
Summary
--cpus=N), the frontend was dividing raw CPU% by1instead ofN. A--cpus=2container using 1.5 cores now correctly shows 75% instead of being capped at 100%. Fixed inContainerStatCell,HostCard, andMultiContainerStat.maxCeilingprop (default10) so bar scaling usesmax(dataMax * 1.2, maxCeiling)instead of justmax(data). Idle containers stay visually flat instead of filling the full chart height. Spikes are visible relative to recent history.Test plan
docker run -d --cpus=2 alpine sh -c "for i in 1 2 3 4; do while true; do :; done & done; wait"and verify Dozzle shows ~100% (not capped at 100% from raw 200%)pnpm testandpnpm typecheck— both pass🤖 Generated with Claude Code