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

Unable to obtain "container_spec_cpu_quota" metrics #3601

Open
wangyx89007 opened this issue Sep 27, 2024 · 0 comments
Open

Unable to obtain "container_spec_cpu_quota" metrics #3601

wangyx89007 opened this issue Sep 27, 2024 · 0 comments

Comments

@wangyx89007
Copy link

wangyx89007 commented Sep 27, 2024

I have a long-standing issue that I'd like to consult about:

All containers are limited using Docker Compose with the following configuration:

deploy:
resources:
limits:
cpus: '1'
memory: 1G

Different containers with the same CPU limit exhibit different behaviors. When checking all containers with Docker, the result for "CpuQuota" is 0, which is expected since I haven’t set a specific CPU quota value. However, in cases where no quota is set, I’m seeing that some containers have container_spec_cpu_quota while others do not. This discrepancy is causing Prometheus to calculate the CPU usage for individual containers on the server as significantly high. The specific PromQL query I'm using is:

((sum by(instance, nodename, name) (rate(container_cpu_usage_seconds_total{name!=""}[1m])) / sum by(instance, nodename, name) (container_spec_cpu_quota{name!=""} / container_spec_cpu_period{name!=""})) * 100)

@wangyx89007 wangyx89007 reopened this Sep 27, 2024
@wangyx89007 wangyx89007 changed the title 获取不到container_spec_cpu_quota指标 Unable to obtain "container_spec_cpu_quota" metrics Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant