Add metrics for snapshot generation (#5677) (#5684)

automerge
This commit is contained in:
mergify[bot]
2019-08-27 14:15:12 -07:00
committed by Grimes
parent 9098f02f98
commit 925abbbf15
2 changed files with 1034 additions and 432 deletions

View File

@ -1,6 +1,7 @@
use crate::result::{Error, Result};
use crate::service::Service;
use solana_measure::measure::Measure;
use solana_metrics::datapoint_info;
use solana_runtime::accounts_db::AccountStorageEntry;
use std::fs;
use std::io::{Error as IOError, ErrorKind};
@ -133,12 +134,21 @@ impl SnapshotPackagerService {
// Once everything is successful, overwrite the previous tarball so that other validators
// can fetch this newly packaged snapshot
let _ = fs::remove_file(&snapshot_package.tar_output_file);
let metadata = fs::metadata(&temp_tar_path)?;
fs::hard_link(&temp_tar_path, &snapshot_package.tar_output_file)?;
timer.stop();
info!(
"Successfully created tarball for root: {}, elapsed ms: {}",
"Successfully created tarball. slot: {}, elapsed ms: {}, size={}",
snapshot_package.root,
timer.as_ms()
timer.as_ms(),
metadata.len()
);
datapoint_info!(
"snapshot-package",
("slot", snapshot_package.root, i64),
("duration_ms", timer.as_ms(), i64),
("size", metadata.len(), i64)
);
Ok(())
}