diff --git a/gossip/src/cluster_info.rs b/gossip/src/cluster_info.rs index f18b23af4c..9bae459501 100644 --- a/gossip/src/cluster_info.rs +++ b/gossip/src/cluster_info.rs @@ -1556,6 +1556,7 @@ impl ClusterInfo { sender: &PacketBatchSender, generate_pull_requests: bool, ) -> Result<(), GossipError> { + let _st = ScopedTimer::from(&self.stats.gossip_transmit_loop_time); let reqs = self.generate_new_gossip_requests( thread_pool, gossip_validators, @@ -1573,6 +1574,9 @@ impl ClusterInfo { .add_relaxed(packet_batch.len() as u64); sender.send(packet_batch)?; } + self.stats + .gossip_transmit_loop_iterations_since_last_report + .add_relaxed(1); Ok(()) } @@ -2435,6 +2439,9 @@ impl ClusterInfo { stakes, response_sender, ); + self.stats + .process_gossip_packets_iterations_since_last_report + .add_relaxed(1); Ok(()) } @@ -2490,6 +2497,7 @@ impl ClusterInfo { last_print: &mut Instant, should_check_duplicate_instance: bool, ) -> Result<(), GossipError> { + let _st = ScopedTimer::from(&self.stats.gossip_listen_loop_time); const RECV_TIMEOUT: Duration = Duration::from_secs(1); const SUBMIT_GOSSIP_STATS_INTERVAL: Duration = Duration::from_secs(2); let mut packets = VecDeque::from(receiver.recv_timeout(RECV_TIMEOUT)?); @@ -2528,6 +2536,9 @@ impl ClusterInfo { submit_gossip_stats(&self.stats, &self.gossip, &stakes); *last_print = Instant::now(); } + self.stats + .gossip_listen_loop_iterations_since_last_report + .add_relaxed(1); Ok(()) } diff --git a/gossip/src/cluster_info_metrics.rs b/gossip/src/cluster_info_metrics.rs index 27bd8b98b2..81e63a0163 100644 --- a/gossip/src/cluster_info_metrics.rs +++ b/gossip/src/cluster_info_metrics.rs @@ -103,6 +103,8 @@ pub struct GossipStats { pub(crate) get_epoch_duration_no_working_bank: Counter, pub(crate) get_votes: Counter, pub(crate) get_votes_count: Counter, + pub(crate) gossip_listen_loop_iterations_since_last_report: Counter, + pub(crate) gossip_listen_loop_time: Counter, pub(crate) gossip_packets_dropped_count: Counter, pub(crate) gossip_ping_msg_verify_fail: Counter, pub(crate) gossip_pong_msg_verify_fail: Counter, @@ -113,6 +115,8 @@ pub struct GossipStats { pub(crate) gossip_pull_request_verify_fail: Counter, pub(crate) gossip_pull_response_verify_fail: Counter, pub(crate) gossip_push_msg_verify_fail: Counter, + pub(crate) gossip_transmit_loop_iterations_since_last_report: Counter, + pub(crate) gossip_transmit_loop_time: Counter, pub(crate) handle_batch_ping_messages_time: Counter, pub(crate) handle_batch_pong_messages_time: Counter, pub(crate) handle_batch_prune_messages_time: Counter, @@ -137,6 +141,7 @@ pub struct GossipStats { pub(crate) packets_sent_pull_requests_count: Counter, pub(crate) packets_sent_pull_responses_count: Counter, pub(crate) packets_sent_push_messages_count: Counter, + pub(crate) process_gossip_packets_iterations_since_last_report: Counter, pub(crate) process_gossip_packets_time: Counter, pub(crate) process_prune: Counter, pub(crate) process_pull_requests: Counter, @@ -385,6 +390,37 @@ pub(crate) fn submit_gossip_stats( stats.gossip_pull_request_dropped_requests.clear(), i64 ), + ( + "gossip_transmit_loop_time", + stats.gossip_transmit_loop_time.clear(), + i64 + ), + ( + "gossip_transmit_loop_iterations_since_last_report", + stats + .gossip_transmit_loop_iterations_since_last_report + .clear(), + i64 + ), + ( + "gossip_listen_loop_time", + stats.gossip_listen_loop_time.clear(), + i64 + ), + ( + "gossip_listen_loop_iterations_since_last_report", + stats + .gossip_listen_loop_iterations_since_last_report + .clear(), + i64 + ), + ( + "process_gossip_packets_iterations_since_last_report", + stats + .process_gossip_packets_iterations_since_last_report + .clear(), + i64 + ), ); datapoint_info!( "cluster_info_stats4",