diff --git a/substrate/primitives/utils/README.md b/substrate/primitives/utils/README.md index b0e04a3f4f..2da70f09cc 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` +and `UnboundedReceiver` 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 430ec1ecb6..6461361c96 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` +//! and `UnboundedReceiver` 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;