-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix cgroup v2 swap-only memory metrics for KIND #3824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix cgroup v2 swap-only memory metrics for KIND #3824
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
I’ve signed the Google CLA. Could you please recheck? |
|
/cc @ajaysundark |
|
@AkshatDudeja77 the PR is not complete. just adding a file in vendor/ is not going to help from what i can tell. |
|
The description is misleading. it is not that cgroupv2 swap/stats collection is not working, but it is not working for "kind". The file added in this PR is from opencontainers/cgroups which is the module used by cadvisor for stats collection. And from what I can see here: https://github.com/opencontainers/cgroups/blob/e0c56cb31dcb3cb2b3d1554b20dd01ced32e2a2b/fs2/memory.go#L115-L119 cgroupv2 swap collection is correctly handled. I dont see any code changes in this file, it seems to be just a plain import. did you miss to add your changes in the cadvisor itself? |
|
/retitle Fix cgroup v2 swap-only memory metrics for KIND |
|
Thanks for the clarification. I agree that this issue is specific to KIND. I’ve updated the PR title accordingly and will add the missing cAdvisor-side changes. |
|
This PR fixes incorrect swap reporting under cgroup v2. Previously, cAdvisor derived swap as SwapUsage - MemoryUsage, which is incorrect for cgroup v2. The fix ensures swap metrics are sourced from cgroup v2 swap-only accounting, aligning container stats with kernel semantics and Prometheus metrics output. |
This change fixes reporting of swap-only memory metrics for cgroup v2.
Previously, swap usage was either missing or incorrectly derived. This update
adds proper parsing and exposure of swap-only usage so that metrics such as
container_memory_swap and related fields reflect actual cgroup v2 behavior.
Tested locally on cgroup v2 (WSL2) and verified metrics via /metrics endpoint.