Skip to content
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

helpers: fix reading cpu stats on cgroup v2 #2839

Merged
merged 3 commits into from
Mar 29, 2021

Conversation

giuseppe
Copy link
Contributor

read quota and limit from cpu.max, and convert cpu.weight to the range
expected with cgroup v1.

Signed-off-by: Giuseppe Scrivano gscrivan@redhat.com

@k8s-ci-robot
Copy link
Collaborator

Hi @giuseppe. Thanks for your PR.

I'm waiting for a google member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@giuseppe
Copy link
Contributor Author

/cc @odinuge

Copy link
Contributor

@odinuge odinuge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Was going to fix this, but didn't have time... 😅 This fixes quota related metrics for cadvisor and k8s. 😄

container/common/helpers.go Outdated Show resolved Hide resolved
container/common/helpers.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@iwankgb iwankgb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My 3 cents. Do you think it would be possible to mock both version of cgroupfs and run create a test that would read from such a file system?

container/common/helpers.go Show resolved Hide resolved
container/common/helpers.go Outdated Show resolved Hide resolved
container/common/helpers.go Show resolved Hide resolved
@iwankgb
Copy link
Collaborator

iwankgb commented Mar 25, 2021

/ok-to-test

@giuseppe
Copy link
Contributor Author

Do you think it would be possible to mock both version of cgroupfs and run create a test that would read from such a file system?

I guess it should be doable, I'll take a look

@giuseppe
Copy link
Contributor Author

Do you think it would be possible to mock both version of cgroupfs and run create a test that would read from such a file system?

is it a blocker for this PR?

@iwankgb
Copy link
Collaborator

iwankgb commented Mar 26, 2021

is it a blocker for this PR?

It would be appreciated. If you think it's undoable or difficult to do (e.g. because of cAdvisor architecture then let me know, please).

read quota and limit from cpu.max, and convert cpu.weight to the range
expected with cgroup v1.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe
Copy link
Contributor Author

It would be appreciated. If you think it's undoable or difficult to do (e.g. because of cAdvisor architecture then let me know, please).

thanks. Tests added as you've suggested

@iwankgb iwankgb merged commit ef7e64f into google:master Mar 29, 2021
chenchun pushed a commit to chenchun/kubernetes that referenced this pull request Mar 20, 2024
chenchun pushed a commit to chenchun/kubernetes that referenced this pull request Mar 20, 2024
移植upstream对kubelet及cadvisor的修改,修复使用cgroupv2时指标收集统计的问题
1. port cadvisor pr google/cadvisor#2839 reading cpu stats on cgroup v2
2. port cadvisor pr google/cadvisor#2837 read "max" value for cgroup v2
3. port cadvisor pr google/cadvisor#2801 gathering of stats for root cgroup on v2
4. port cadvisor pr google/cadvisor#2800: Update heuristic for container creation time
5. Fix cgroup handling for systemd with cgroup v2
6. test: adjust summary test for cgroup v2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants