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 Run ID: 📒 Files selected for processing (2)
📜 Recent review details🔇 Additional comments (2)
📝 WalkthroughWalkthroughResource polling now caches Podman runtime detection and selects runtime-specific absolute CPU calculations. Docker uses ChangesPodman CPU statistics
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ResourcePolling
participant DockerAPI
participant CPUCalculation
ResourcePolling->>DockerAPI: detect runtime from Engine version
DockerAPI-->>ResourcePolling: return version components
ResourcePolling->>DockerAPI: read container stats
DockerAPI-->>ResourcePolling: return stats sample
ResourcePolling->>CPUCalculation: calculate absolute CPU with runtime flag
CPUCalculation-->>ResourcePolling: return CPU usage
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
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