runc
runc copied to clipboard
libcontainer: include cgroupv2 memory.events in Manager.GetStats
Changes
-
This PR reads from
memory.events
and adds the values to the returned structStats.MemoryStats
inManager.GetStats
-
In cgroup v2,
memory.events
includes some useful metrics on memory throttle and oom kill on the cgroup.
Why
- Original use case is for cadvisor to expose those values as Prometheus metrics. (cadvisor uses runc libcontainer to read some cgroup stats)
- The cadvisor code change (not merged, just demo the idea)
Others
- The change adds on additional file read to
Manager.GetStats
- The purpose of the change is to allow the user of runc as a library (e.g. cadvisor) to read
memory.events
, not to modify current behavior. I was considering adding the code to a separate methodsMemoryEvents
instead of modifying the originalGetStats
. I'm not too sure which one fits better with the code design, let me know your feedback.
Signed-off-by: Nguyen Phan Huy [email protected]
Hi @kolyshkin, could you help to see if this feature could be added to runc's libcontainer? (I am not sure who to reach out to ask, I saw you're active on the recent MRs)
May I carry the rest of the work? I think it just remain some test task
May I carry the rest of the work? I think it just remain some test task
Sure! Thank you