mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-23 23:01:33 +00:00
protocols/gossipsub: Add mesh metrics (#2316)
Enable instrumenting mesh through metrics and add gossipsub to misc/metrics. Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
@ -25,6 +25,8 @@
|
||||
//!
|
||||
//! See `examples` directory for more.
|
||||
|
||||
#[cfg(feature = "gossipsub")]
|
||||
mod gossipsub;
|
||||
#[cfg(feature = "identify")]
|
||||
mod identify;
|
||||
#[cfg(feature = "kad")]
|
||||
@ -37,6 +39,8 @@ use open_metrics_client::registry::Registry;
|
||||
|
||||
/// Set of Swarm and protocol metrics derived from emitted events.
|
||||
pub struct Metrics {
|
||||
#[cfg(feature = "gossipsub")]
|
||||
gossipsub: gossipsub::Metrics,
|
||||
#[cfg(feature = "identify")]
|
||||
identify: identify::Metrics,
|
||||
#[cfg(feature = "kad")]
|
||||
@ -58,6 +62,8 @@ impl Metrics {
|
||||
pub fn new(registry: &mut Registry) -> Self {
|
||||
let sub_registry = registry.sub_registry_with_prefix("libp2p");
|
||||
Self {
|
||||
#[cfg(feature = "gossipsub")]
|
||||
gossipsub: gossipsub::Metrics::new(sub_registry),
|
||||
#[cfg(feature = "identify")]
|
||||
identify: identify::Metrics::new(sub_registry),
|
||||
#[cfg(feature = "kad")]
|
||||
|
Reference in New Issue
Block a user