-
Notifications
You must be signed in to change notification settings - Fork 897
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
Add system.cpu.count metric #2384
Conversation
Does this mean |
Per the definition of the javadoc, https://www.tutorialspoint.com/java/lang/runtime_availableprocessors.htm the |
I believe this should be a "process.cpu.available" or something like that metric. Since this is just the number of cores available to that specific instance of the JVM. May even be a jvm specific metric. |
@@ -35,6 +35,7 @@ instruments not explicitly defined in the specification. | |||
| | | | | | cpu | CPU number [0..n-1] | | |||
| system.cpu.utilization | | 1 | Asynchronous Gauge | Double | state | idle, user, system, interrupt, etc. | | |||
| | | | | | cpu | CPU number (0..n) | | |||
| system.cpu.count | | 1 | Asynchronous UpDownCounter | Int64 | | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a Gauge, since it does not sum "anything".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it counts sums cores(?)
@trask here is what I found https://www.oracle.com/java/technologies/javase/8u191-relnotes.html#JDK-8146115 which means that the value is ... definitely not the number of total CPUs in the environment. Or it can or cannot be to be more exact :) |
this is a great point I did a test:
and I'll open a new PR for I don't have any specific need for this PR anymore, but happy to move it forward if there's interest. |
I am in favour of closing unless there is good evidence that the CPU count at the system level can actually change at runtime and there is a use case that needs this as a metric. |
No objection to closing |
I wasn't sure if this should be a resource attribute or metric, but I tested that cpu count can change at runtime, e.g.
docker update --cpuset-cpus
, andnproc
and JavaRuntime.availableProcessors()
pick up the change at runtime, so seems like it should be a metric.Changes
Adds a new metric
system.cpu.count
to capture the number of CPUs available.