diff --git a/substrate/primitives/utils/README.md b/substrate/primitives/utils/README.md index b0e04a3f4f1988e1a8ef88a9686e32d20bbcc4f8..2da70f09ccbc5677d7a29ad5126998d8c945b77e 100644 --- a/substrate/primitives/utils/README.md +++ b/substrate/primitives/utils/README.md @@ -1,3 +1,20 @@ Utilities Primitives for Substrate -License: Apache-2.0 \ No newline at end of file +## Features + +### metered + +This feature changes the behaviour of the function `mpsc::tracing_unbounded`. +With the disabled feature this function is an alias to `futures::channel::mpsc::unbounded`. +However, when the feature is enabled it creates wrapper types to `UnboundedSender<T>` +and `UnboundedReceiver<T>` to register every `send`/`received`/`dropped` action happened on +the channel. + +Also this feature creates and registers a prometheus vector with name `unbounded_channel_len` and labels: + +| Label | Description | +| ------------ | --------------------------------------------- | +| entity | Name of channel passed to `tracing_unbounded` | +| action | One of `send`/`received`/`dropped` | + +License: Apache-2.0 diff --git a/substrate/primitives/utils/src/lib.rs b/substrate/primitives/utils/src/lib.rs index 430ec1ecb6f6c17b7d61dd5e814cd69773d4cd83..6461361c96d1d988e380fbfe19258ae2a027a9c6 100644 --- a/substrate/primitives/utils/src/lib.rs +++ b/substrate/primitives/utils/src/lib.rs @@ -16,6 +16,23 @@ // limitations under the License. //! Utilities Primitives for Substrate +//! +//! # Features +//! +//! ## metered +//! +//! This feature changes the behaviour of the function `mpsc::tracing_unbounded`. +//! With the disabled feature this function is an alias to `futures::channel::mpsc::unbounded`. +//! However, when the feature is enabled it creates wrapper types to `UnboundedSender<T>` +//! and `UnboundedReceiver<T>` to register every `send`/`received`/`dropped` action happened on +//! the channel. +//! +//! Also this feature creates and registers a prometheus vector with name `unbounded_channel_len` and labels: +//! +//! | Label | Description | +//! | ------------ | --------------------------------------------- | +//! | entity | Name of channel passed to `tracing_unbounded` | +//! | action | One of `send`/`received`/`dropped` | pub mod metrics; pub mod mpsc;