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
Export thread count from process_collector
#401
Export thread count from process_collector
#401
Conversation
b2d6349
to
ce11f25
Compare
Gentle nudge. |
Thanks for the PR. Please note however that the ProcessCollector implements https://prometheus.io/docs/instrumenting/writing_clientlibs/#process-metrics. I'm thus wary of adding more arbitrary stuff directly here. I'd be happy to see the "Number of OS threads" metrics standardized upstream, and once that is published we can promptly merge this. |
Is anything like that being worked on (upstream, I mean)? On the one hand the Golang library has On the other hand, the only other way of getting this metric (other than everyone rolling their own implementation, which is what we ended up doing) is to enable the (by default disabled) I'm not going to insist that this be merged, but the fact that |
I'm not aware of any such discussion, so I started it at prometheus/docs#1964. As you mentioned, it is a common metrics across libraries so it makes sense to have it uniformed. Plus, the |
src/process_collector.rs
Outdated
@@ -100,6 +101,12 @@ impl ProcessCollector { | |||
.unwrap(); | |||
descs.extend(start_time.desc().into_iter().cloned()); | |||
|
|||
let threads = Gauge::with_opts( | |||
Opts::new("process_threads", "Number of OS threads.").namespace(namespace.clone()), |
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.
Number of OS threads in the process.
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.
Done,
@free sorry for putting this through the long path. The upstream doc change has been merged, so this can land too. It only needs a rebase and a minor rewording. |
268c6f7
to
3f21f15
Compare
This simply retrieves and exports the value of the field from the already populated that CPU, memory and start time are sourced. Signed-off-by: Alin Sinpalean <alin.sinpalean@gmail.com>
3f21f15
to
e1905a6
Compare
Phew, took a bit to get the DCO right.
No worries, thanks for following through. I put together a polyfill locally in the meantime, so no problem. |
This simply retrieves and exports the value of the field from the already populated that CPU, memory and start time are sourced. Signed-off-by: Alin Sinpalean <alin.sinpalean@gmail.com> Signed-off-by: Jan Berktold <jberktold@roblox.com>
This simply retrieves and exports the value of the
num_threads
field from thealready populated
procfs::process::Stat
that CPU, memory and start time aresourced.