paritytech / orchestra

A partial actor pattern with a global orchestrator.
GNU General Public License v3.0
27 stars 3 forks source link

Add meter for channel len #59

Closed sandreim closed 1 year ago

sandreim commented 1 year ago

Currently we use prometheus query to measure channel size but this is notoriously inaccurate, especially when scrapers are under high load.

For async_channel, len() is supported, but for futures_channel we compute it based on sent/received.

sandreim commented 1 year ago

I think the implementation could be simplified more, no need for a new Arc, we can compute at meter reading time from sent/received.

vstakhov commented 1 year ago

we can compute at meter reading time from sent/received.

It is true unless these counters are overflowed. However, overflowing of usize is not... realistic.

sandreim commented 1 year ago

we can compute at meter reading time from sent/received.

It is true unless these counters are overflowed. However, overflowing of usize is not... realistic.

Saturating arithmetic should help