Skip to content

Commit 19a6887

Browse files
authored
fix(gossipsub): relax Behaviour::with_metrics,
Pull-Request: #6114.
1 parent eef67f6 commit 19a6887

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

protocols/gossipsub/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## 0.50.0
22

3+
- Relax `Behaviour::with_metrics` requirements, do not require DataTransform and TopicSubscriptionFilter to also impl Default
4+
See [PR XXXX](https://github.com/libp2p/rust-libp2p/pull/6097)
5+
36
- Remove `Rpc` from the public API.
47
See [PR 6091](https://github.com/libp2p/rust-libp2p/pull/6091)
58

protocols/gossipsub/src/behaviour.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -360,18 +360,6 @@ where
360360
D::default(),
361361
)
362362
}
363-
364-
/// Allow the [`Behaviour`] to also record metrics.
365-
/// Metrics can be evaluated by passing a reference to a [`Registry`].
366-
#[cfg(feature = "metrics")]
367-
pub fn with_metrics(
368-
mut self,
369-
metrics_registry: &mut Registry,
370-
metrics_config: MetricsConfig,
371-
) -> Self {
372-
self.metrics = Some(Metrics::new(metrics_registry, metrics_config));
373-
self
374-
}
375363
}
376364

377365
impl<D, F> Behaviour<D, F>
@@ -469,6 +457,18 @@ where
469457
gossip_promises: Default::default(),
470458
})
471459
}
460+
461+
/// Allow the [`Behaviour`] to also record metrics.
462+
/// Metrics can be evaluated by passing a reference to a [`Registry`].
463+
#[cfg(feature = "metrics")]
464+
pub fn with_metrics(
465+
mut self,
466+
metrics_registry: &mut Registry,
467+
metrics_config: MetricsConfig,
468+
) -> Self {
469+
self.metrics = Some(Metrics::new(metrics_registry, metrics_config));
470+
self
471+
}
472472
}
473473

474474
impl<D, F> Behaviour<D, F>

0 commit comments

Comments
 (0)