shirou / gopsutil

psutil for golang
Other
10.56k stars 1.58k forks source link

Getting wrong values for a kubernetes pod #1320

Open shubhindia opened 2 years ago

shubhindia commented 2 years ago

Describe the bug I am using gopsutil to get CPU, memory and load usage for a particular pod (This is part of an internal logger). So when we use this (logger) in our CI (which is in kubernetes), instead of reporting the pod CPU and memory, it is reporting values for the node on which the pod is running. For e.g. We have a job which runs in a container which has 32GB memory, so it should return total memory as 34,359,738,368 bytes but instead it is returning 236447424512 which is around 236GB and this is node memory not the memory which was allocated to the pod.

Expected behavior It should return 34,359,738,368 instead of 236447424512

aaronbuchwald commented 1 year ago

Does this library plan to address this issue so that it can correctly calculate this for k8s pods or is this likely to stay the same?

tangobango5 commented 8 months ago

Any update here?

MUCZ commented 2 weeks ago

This issue still exists now

shubhindia commented 2 weeks ago

Yes, I have an idea around this, will try it out once I get some free time.