mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 07:01:05 +00:00
Fix the metered unbounded sender/recievers (#6246)
* Fix the metered unbounded sender/recievers * Use a counter instead * Update client/rpc/src/system/tests.rs * Add an is_terminated check * Add FusedStream impl Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -23,8 +23,8 @@ use prometheus::{
|
||||
core::{ AtomicU64, GenericGauge, GenericCounter },
|
||||
};
|
||||
|
||||
#[cfg(features = "metered")]
|
||||
use prometheus::{core::GenericGaugeVec, Opts};
|
||||
#[cfg(feature = "metered")]
|
||||
use prometheus::{core::GenericCounterVec, Opts};
|
||||
|
||||
|
||||
lazy_static! {
|
||||
@@ -37,9 +37,9 @@ lazy_static! {
|
||||
).expect("Creating of statics doesn't fail. qed");
|
||||
}
|
||||
|
||||
#[cfg(features = "metered")]
|
||||
#[cfg(feature = "metered")]
|
||||
lazy_static! {
|
||||
pub static ref UNBOUNDED_CHANNELS_COUNTER : GenericGaugeVec<AtomicU64> = GenericGaugeVec::new(
|
||||
pub static ref UNBOUNDED_CHANNELS_COUNTER : GenericCounterVec<AtomicU64> = GenericCounterVec::new(
|
||||
Opts::new("unbounded_channel_len", "Items in each mpsc::unbounded instance"),
|
||||
&["entity", "action"] // 'name of channel, send|received|dropped
|
||||
).expect("Creating of statics doesn't fail. qed");
|
||||
@@ -52,7 +52,7 @@ pub fn register_globals(registry: &Registry) -> Result<(), PrometheusError> {
|
||||
registry.register(Box::new(TOKIO_THREADS_ALIVE.clone()))?;
|
||||
registry.register(Box::new(TOKIO_THREADS_TOTAL.clone()))?;
|
||||
|
||||
#[cfg(features = "metered")]
|
||||
#[cfg(feature = "metered")]
|
||||
registry.register(Box::new(UNBOUNDED_CHANNELS_COUNTER.clone()))?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user