Skip to content

Commit

Permalink
Add metric measuring number of successfully inserted push messages (#…
Browse files Browse the repository at this point in the history
…20275)

* Add number of successfully inserted push messages

(cherry picked from commit ee8621a)
  • Loading branch information
carllin committed Sep 29, 2021
1 parent a005a6b commit 56bd896
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
7 changes: 6 additions & 1 deletion gossip/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2209,7 +2209,12 @@ impl ClusterInfo {
messages
.into_iter()
.flat_map(|(from, crds_values)| {
gossip.process_push_message(&from, crds_values, now)
let (num_success, origins) =
gossip.process_push_message(&from, crds_values, now);
self.stats
.process_push_success
.add_relaxed(num_success as u64);
origins
})
.collect()
};
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 @@ -134,6 +134,7 @@ pub(crate) struct GossipStats {
pub(crate) process_pull_response_success: Counter,
pub(crate) process_pull_response_timeout: Counter,
pub(crate) process_push_message: Counter,
pub(crate) process_push_success: Counter,
pub(crate) prune_message_count: Counter,
pub(crate) prune_message_len: Counter,
pub(crate) prune_received_cache: Counter,
Expand Down Expand Up @@ -203,6 +204,11 @@ pub(crate) fn submit_gossip_stats(
("repair_peers", stats.repair_peers.clear(), i64),
("new_push_requests", stats.new_push_requests.clear(), i64),
("new_push_requests2", stats.new_push_requests2.clear(), i64),
(
"process_push_success",
stats.process_push_success.clear(),
i64
),
("purge", stats.purge.clear(), i64),
(
"process_gossip_packets_time",
Expand Down
10 changes: 7 additions & 3 deletions gossip/src/crds_gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,21 @@ impl CrdsGossip {
from: &Pubkey,
values: Vec<CrdsValue>,
now: u64,
) -> HashSet<Pubkey> {
values
) -> (usize, HashSet<Pubkey>) {
let mut success_count = 0;
let successfully_inserted_origin_set: HashSet<Pubkey> = values
.into_iter()
.filter_map(|val| {
let origin = val.pubkey();
self.push
.process_push_message(&mut self.crds, from, val, now)
.ok()?;
success_count += 1;
Some(origin)
})
.collect()
.collect();

(success_count, successfully_inserted_origin_set)
}

/// remove redundant paths in the network
Expand Down
1 change: 1 addition & 0 deletions gossip/tests/crds_gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ fn network_run_push(
.lock()
.unwrap()
.process_push_message(&from, msgs.clone(), now)
.1
.into_iter()
.collect();
let prunes_map = network
Expand Down
1 change: 0 additions & 1 deletion upload-perf/src/upload-perf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ fn main() {
("commit", git_commit_hash.trim().to_string(), String)
);
*/

}
let last_median =
get_last_metrics(&"median".to_string(), &db, &name, branch).unwrap_or_default();
Expand Down

0 comments on commit 56bd896

Please sign in to comment.