Skip to content

Commit

Permalink
adds a metric for number of unverified gossip addresses (#1671)
Browse files Browse the repository at this point in the history
  • Loading branch information
behzadnouri authored Jun 10, 2024
1 parent 20549d9 commit 2493542
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gossip/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2473,15 +2473,20 @@ impl ClusterInfo {
let mut rng = rand::thread_rng();
let keypair: Arc<Keypair> = self.keypair().clone();
let mut verify_gossip_addr = |value: &CrdsValue| {
verify_gossip_addr(
if verify_gossip_addr(
&mut rng,
&keypair,
value,
stakes,
&self.socket_addr_space,
&self.ping_cache,
&mut pings,
)
) {
true
} else {
self.stats.num_unverifed_gossip_addrs.add_relaxed(1);
false
}
};
// Split packets based on their types.
let mut pull_requests = vec![];
Expand Down
6 changes: 6 additions & 0 deletions gossip/src/cluster_info_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ pub struct GossipStats {
pub(crate) new_push_requests2: Counter,
pub(crate) new_push_requests: Counter,
pub(crate) new_push_requests_num: Counter,
pub(crate) num_unverifed_gossip_addrs: Counter,
pub(crate) packets_received_count: Counter,
pub(crate) packets_received_ping_messages_count: Counter,
pub(crate) packets_received_pong_messages_count: Counter,
Expand Down Expand Up @@ -494,6 +495,11 @@ pub(crate) fn submit_gossip_stats(
stats.pull_requests_count.clear(),
i64
),
(
"num_unverifed_gossip_addrs",
stats.num_unverifed_gossip_addrs.clear(),
i64
),
(
"packets_received_count",
stats.packets_received_count.clear(),
Expand Down

0 comments on commit 2493542

Please sign in to comment.