This is available in the new Go runtime metrics, you can enable it in your
application with a runtime metrics filter.

https://github.com/prometheus/client_golang/blob/9801a4e3ceb49d24dfaf4fa6fc8c2d58aa3b2dc9/prometheus/collectors/go_collector_latest_test.go#L284

You'll probably want `/sched/gomaxprocs:threads` as your custom rule.

On Tue, Sep 13, 2022 at 11:31 AM 'damianqin' via Prometheus Developers <
[email protected]> wrote:

> Hello folks!
>     When we maintain the golang service on k8s, we will automatically set
> the GOMAXPROCS environment variable equal to the Pod limit in the cd
> process to reduce the occurrence of cpu throttling, but other developers
> may use runtime.GOMAXPROCS <https://pkg.go.dev/runtime#GOMAXPROCS> to
> override the parameters, resulting in application performance down. I think
> client_golang can use the runtime.GOMAXPROCS(0) method to expose the
> current indicator value.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prometheus Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-developers/1db181d7-950a-4437-b69c-aa5cc329ae9fn%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-developers/1db181d7-950a-4437-b69c-aa5cc329ae9fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-developers/CABbyFmpdu%2BesdcoP6EHAPGsyQfqhQYMzehFj23GOcUnxbbpHFg%40mail.gmail.com.

Reply via email to