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
instrumenting/clientlibs: add process_threads #1964
Conversation
9921974
to
6f073af
Compare
Thanks for the sugestion. I do not think that go or java exposes that metric, can you be more specific? Also, is the threading model the same accross all OS? Would that metric mean the same for different OS? |
@roidelapluie that's documented in the linked "For more context and existing languages/libraries references", but let me duplicate that here explicitly:
"Number of OS threads" is not really runtime/language specific, but individual libraries do not freely own the
The threading model could be different, specifically on what is the exact definition of an "OS thread" (if that primitive exists in the OS). |
jvm_threads_current is threads, it is not OS threads, so the meaning is different. On certain OS, this can map to OS threads but AFAIK this is not guaranteed. |
@roidelapluie fair point, thanks for the feedback. I wasn't sure about each runtime details (Go one either), but I did mention above that keeping other runtime-specific metrics is fine and orthogonal. Specifically, green-threads or only-threads-owned-by-the-runtime. This still leaves us with:
Other than removing the "other libraries" mention in my commit, in which direction should I push this PR to cover the usecase above? |
One argument in favor of adding Also, the document already says "client libraries SHOULD prefer leaving out the corresponding metric over exporting bogus, inaccurate, or special values", so it's not like this addition will break any client library's compatibility or anything. E.g. if Java uses a different mechanism to retrieve thread count (and Java threads are not necessarily the same as OS threads), then it can simply leave this out (which I suspect it already does with all process metrics). |
I believe a lot of things are not standard across OSs. E.g. I believe Fuchsia does not have file descriptors. And for all I know there may be OSs without a concept or resident vs. virtual memory. But overall, I believe all widely used OSs have the concept of threads. And again, the documentation says "leave it out if it doesn't make sense", so there doesn't seem to be a requirement that all process metrics make sense on every single OS. I mean some of the things Prometheus monitors aren't even processes. |
6f073af
to
edc75c5
Compare
Gentle ping. In the meanwhile I've rebased this and updated the commit message to avoid mislead references to other libraries/runtimes, PTAL. |
This reserves a new well-known `process_threads` gauge for client libraries, in order to expose OS threads count on all instrumented processes. As this metrics is language/runtime independent, it makes sense to be under the `process_` namespace so that libraries can align on the name (if/when they start exposing this). Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>
e7d2e79
to
72b9ad3
Compare
I am basically fine adding it, though I wonder if I might also be overthinking this. |
Those would be |
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.
LGTM
Thanks all! |
This reserves a new well-known
process_threads
gauge for clientlibraries, in order to expose OS threads count on all instrumented
processes.
As this metrics is language/runtime independent, it makes sense to
be under the
process_
namespace so that libraries can align onthe name (if/when they start exposing this).
For reference, this is coming from an enhancement request on the Rust library: tikv/rust-prometheus#401.