Skip to content

Commit b3bb435

Browse files
authored
Add snapshot download metrics (solana-labs#31111)
* Add snapshot download metrics
1 parent 9a7b6ab commit b3bb435

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

validator/src/bootstrap.rs

+28-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use {
1111
gossip_service::GossipService,
1212
legacy_contact_info::LegacyContactInfo as ContactInfo,
1313
},
14+
solana_metrics::datapoint_info,
1415
solana_rpc_client::rpc_client::RpcClient,
1516
solana_runtime::{
1617
snapshot_archive_info::SnapshotArchiveInfoGetter,
@@ -593,6 +594,9 @@ pub fn rpc_bootstrap(
593594
return;
594595
}
595596

597+
let total_snapshot_download_time = Instant::now();
598+
let mut get_rpc_nodes_time = Duration::new(0, 0);
599+
let mut snapshot_download_time = Duration::new(0, 0);
596600
let mut blacklisted_rpc_nodes = HashSet::new();
597601
let mut gossip = None;
598602
let mut vetted_rpc_nodes = vec![];
@@ -617,6 +621,7 @@ pub fn rpc_bootstrap(
617621
));
618622
}
619623

624+
let get_rpc_nodes_start = Instant::now();
620625
get_vetted_rpc_nodes(
621626
&mut vetted_rpc_nodes,
622627
&gossip.as_ref().unwrap().0,
@@ -626,8 +631,10 @@ pub fn rpc_bootstrap(
626631
&bootstrap_config,
627632
);
628633
let (rpc_contact_info, snapshot_hash, rpc_client) = vetted_rpc_nodes.pop().unwrap();
634+
get_rpc_nodes_time += get_rpc_nodes_start.elapsed();
629635

630-
match attempt_download_genesis_and_snapshot(
636+
let snapshot_download_start = Instant::now();
637+
let download_result = attempt_download_genesis_and_snapshot(
631638
&rpc_contact_info,
632639
ledger_path,
633640
validator_config,
@@ -646,7 +653,9 @@ pub fn rpc_bootstrap(
646653
identity_keypair,
647654
vote_account,
648655
authorized_voter_keypairs.clone(),
649-
) {
656+
);
657+
snapshot_download_time += snapshot_download_start.elapsed();
658+
match download_result {
650659
Ok(()) => break,
651660
Err(err) => {
652661
fail_rpc_node(
@@ -662,6 +671,23 @@ pub fn rpc_bootstrap(
662671
if let Some(gossip) = gossip.take() {
663672
shutdown_gossip_service(gossip);
664673
}
674+
675+
datapoint_info!(
676+
"bootstrap-snapshot-download",
677+
(
678+
"total_time_secs",
679+
total_snapshot_download_time.elapsed().as_secs(),
680+
i64
681+
),
682+
("get_rpc_nodes_time_secs", get_rpc_nodes_time.as_secs(), i64),
683+
(
684+
"snapshot_download_time_secs",
685+
snapshot_download_time.as_secs(),
686+
i64
687+
),
688+
("download_abort_count", download_abort_count, i64),
689+
("blacklisted_nodes_count", blacklisted_rpc_nodes.len(), i64),
690+
);
665691
}
666692

667693
/// Get RPC peer node candidates to download from.

0 commit comments

Comments
 (0)