tokio-prometheus-metered-channel

Crates.iotokio-prometheus-metered-channel
lib.rstokio-prometheus-metered-channel
version0.1.0
sourcesrc
created_at2024-11-29 18:41:09.887319
updated_at2024-11-29 18:41:09.887319
descriptionMetered tokio channels with Prometheus metrics integration
homepage
repositoryhttps://github.com/huitseeker/tokio-prometheus-metered-channel
max_upload_size
id1465911
size51,755
François Garillot (huitseeker)

documentation

https://docs.rs/tokio-prometheus-metered-channel

README

Tokio Prometheus metered channel

Add the following to your Cargo.toml:

tokio-prometheus-metered-channel = "0.1.0"

Metered Bounded Channel

The metered bounded channel is a specialized threading utility designed to handle communication between threads with an upper limit on capacity while tracking the channel's occupancy through Prometheus metrics.

Functionality

  • Bounded Capacity: This channel ensures that no more than a predefined number of messages are held in the channel at any given time.
  • Backpressure Handling: When the channel reaches its capacity, any additional attempts to send messages will be blocked, allowing for backpressure management until the channel has available space.
  • Prometheus Integration: The current occupancy of the channel is exposed as a Prometheus metric, enabling real-time monitoring of how "full" the channel is.
Commit count: 3

cargo fmt