-
Notifications
You must be signed in to change notification settings - Fork 70
Closed
Description
Currently, the cpu_usage
value reported in DockerMachineStats
is always 0, which indicates that the CPU usage is not being computed correctly.
This appears to be caused by an incorrect or incomplete implementation of the CPU usage calculation logic, possibly not following Docker’s standard approach to compute it from container stats.
Kathara/src/Kathara/manager/docker/stats/DockerMachineStats.py
Lines 89 to 92 in bd4b738
if "system_cpu_usage" in updated_stats["cpu_stats"]: | |
cpu_usage = updated_stats["cpu_stats"]["cpu_usage"]["total_usage"] / \ | |
updated_stats["cpu_stats"]["system_cpu_usage"] | |
self.cpu_usage = f"{cpu_usage:.2f}%" |