I'd like to log things like how many goroutines in a function pool (PoolWithFunc) are actually doing something (non-idle). I've tried logging pool.Running() but after a short ramp-up it always shows the maximum number of goroutines (i.e. the cap). The number returned by Waiting() is always 0, so it doesn't seem like the workers are stalled.
Is there a way to get the actual number of non-idle workers?
I think you have to make the statistics in your task function, it would be the most precise way to do that, inject statistics logic into your code and get the result you want.
Questions with details
I'd like to log things like how many goroutines in a function pool (
PoolWithFunc
) are actually doing something (non-idle). I've tried loggingpool.Running()
but after a short ramp-up it always shows the maximum number of goroutines (i.e. the cap). The number returned byWaiting()
is always 0, so it doesn't seem like the workers are stalled.Is there a way to get the actual number of non-idle workers?
Code snippets (optional)
No response