diff --git a/mm2src/lp_native_dex.rs b/mm2src/lp_native_dex.rs index 7aa99aefc3..6bc9e6b79d 100644 --- a/mm2src/lp_native_dex.rs +++ b/mm2src/lp_native_dex.rs @@ -506,7 +506,16 @@ pub async fn lp_init(mypubport: u16, ctx: MmArc) -> Result<(), String> { "p2p.received_messages.period_in_secs", period.as_secs() as i64 ); + mm_gauge!(ctx_on_poll.metrics, "p2p.received_messages.count", received_msgs as i64); + + let connected_peers_count = swarm.connected_peers_len(); + + mm_gauge!( + ctx_on_poll.metrics, + "p2p.connected_peers.count", + connected_peers_count as i64 + ); }, ); try_s!(ctx.peer_id.pin(peer_id.to_string())); diff --git a/mm2src/mm2_libp2p/src/atomicdex_behaviour.rs b/mm2src/mm2_libp2p/src/atomicdex_behaviour.rs index fe7d35a5a5..3ca151a773 100644 --- a/mm2src/mm2_libp2p/src/atomicdex_behaviour.rs +++ b/mm2src/mm2_libp2p/src/atomicdex_behaviour.rs @@ -397,6 +397,8 @@ impl AtomicDexBehaviour { pub fn relay_mesh_len(&self) -> usize { self.gossipsub.relay_mesh_len() } pub fn received_messages_in_period(&self) -> (Duration, usize) { self.gossipsub.get_received_messages_in_period() } + + pub fn connected_peers_len(&self) -> usize { self.gossipsub.get_num_peers() } } impl NetworkBehaviourEventProcess for AtomicDexBehaviour {