I frequently work on designs where an mpsc channel "holds the app together", for example a simple TCP server that connects multiple clients with a shared resource.
When I want to see how my system performs (under load etc.) I can already see many things like the number of enqueued messages.
In some cases, I also want to see the Number of existing Senders for a receiver.
Solution
I'd love it if one could call a method on mpsc::Receiver to get the number of mpsc::Senders.
Alternative
Arc<AtomicUsize> shared by senders? The advantage is that senders could see the sender count too, for whatever use.
Context
I frequently work on designs where an mpsc channel "holds the app together", for example a simple TCP server that connects multiple clients with a shared resource. When I want to see how my system performs (under load etc.) I can already see many things like the number of enqueued messages.
In some cases, I also want to see the Number of existing Senders for a receiver.
Solution
I'd love it if one could call a method on
mpsc::Receiver
to get the number ofmpsc::Senders
.Alternative
Arc<AtomicUsize>
shared by senders? The advantage is that senders could see the sender count too, for whatever use.