Fix reported CPU usage on Podman - #200
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughResource polling now uses one CPU usage calculation based on CPU-time and elapsed sample-time deltas. Runtime detection, Podman state caching, and Docker ChangesCPU statistics calculation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change updates Podman CPU usage calculation while retaining Docker behavior; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Title checkExplanation The title clearly identifies the primary user-facing change: correcting CPU usage reporting for Podman. The implementation also applies the calculation to Docker, but this does not make the title misleading.
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@MatthewCash Can you fix the merge conflict here please? |
# Conflicts: # environment/docker/stats.go
|
I've fixed the merge conflict. But... I think instead we should just do wall-time only, because Docker's formula effectively reduces to the same math anyway, so both runtimes would report identical numbers with one code path. That lets us delete the runtime detection entirely, which is where the real problems are, since the version probe holds a global lock across a network call and a transient failure would silently leave a server on the wrong formula. |
|
Apologies for the delay. I've updated the changes to use wall clock time. Do you want this rebased and squashed? |
This fixes incorrect CPU usage reporting when Wings uses Podman. Podman does not provide Docker-equivalent system CPU values, so CPU usage is now calculated using elapsed wall time instead.
Docker retains its existing calculation, and the container runtime is detected automatically.
I added some tests to cover the Docker and Podman calculations, multi-core usage, counter resets, invalid timestamps, and runtime detection.
Summary by CodeRabbit