Expose if a channel is full or empty (or expose the number of messages in a Channel)

Hi all,
I am happily using co-routines and channels. No problem so far.
Now we need to tune the performance of our flow which is a chain of channels and senders/receivers.
In order to play with the number of workers we have to known which channel is full (to allocate more workers and improve performance).
Unfortunately, there is no way to detect how many messages are in a channel (to detect which one is full and that causes the delay because of the backpressure).
Is there a way to see whether a channel is full or empty ?

Cheers,
Andrey

If all you care about is detecting the full channel, then instead of calling send, call offer. If it returns false, then you know the channel is full, can adjust as needed and then call send (since the offer failed).

Are you using a shared worker pool for all the processing? If all the channels are processed by the same worker pool, then I’d expect worker allocation to adjust naturally since work feeding into the bottleneck would suspend due to the back pressure.

Thank you very much !
This is exactly what I was looking for.

This is required to detect which step in the flow is the bottleneck.