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

process_cpu_count is no longer accurate in .NET Core 3.1 #27

Open
amrmahdi opened this issue Dec 6, 2019 · 3 comments
Open

process_cpu_count is no longer accurate in .NET Core 3.1 #27

amrmahdi opened this issue Dec 6, 2019 · 3 comments

Comments

@amrmahdi
Copy link

amrmahdi commented Dec 6, 2019

Please see dotnet/runtime#622 for reference. Given that the cpu count is now reported as the number of cores on the node, not on the container, this metric is no longer accurate.

@djluck
Copy link
Owner

djluck commented Dec 7, 2019

Interesting stuff- thanks for creating this issue @amrmahdi. https://github.com/dotnet/coreclr/issues/26053 seems to suggest some future workaround (i.e. Environment.ProcessorQuota) but for now, there's not a lot that can be done.

@amrmahdi
Copy link
Author

amrmahdi commented Dec 7, 2019

What if we detect that the process is running a container using DOTNET_RUNNING_IN_CONTAINER then read the CPU shares from /sys/fs/cgroup/cpu/cpu.shares ?

@amrmahdi
Copy link
Author

amrmahdi commented Dec 7, 2019

Actually that is really not needed, since container_spec_cpu_shares counter already published this metric. So I guess if using .NET Core 3.1 one can update the grafana dashboard to use container_spec_cpu_shares instead of process_cpu_count .

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

2 participants