adds validator version to set_panic_hook (#23082)

This commit is contained in:
behzad nouri 2022-02-11 18:04:10 +00:00 committed by GitHub
parent ac13d14e30
commit 78089941ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 6 deletions

View File

@ -21,7 +21,7 @@ pub const NUM_SIGNATURES_FOR_TXS: u64 = 100_000 * 60 * 60 * 24 * 7;
fn main() {
solana_logger::setup_with_default("solana=info");
solana_metrics::set_panic_hook("bench-tps");
solana_metrics::set_panic_hook("bench-tps", /*version:*/ None);
let matches = cli::build_args(solana_version::version!()).get_matches();
let cli_config = cli::extract_args(&matches);

View File

@ -20,7 +20,7 @@ async fn main() {
let default_keypair = solana_cli_config::Config::default().keypair_path;
solana_logger::setup_with_default("solana=info");
solana_metrics::set_panic_hook("faucet");
solana_metrics::set_panic_hook("faucet", /*version:*/ None);
let matches = App::new(crate_name!())
.about(crate_description!())
.version(solana_version::version!())

View File

@ -429,7 +429,7 @@ pub fn flush() {
}
/// Hook the panic handler to generate a data point on each panic
pub fn set_panic_hook(program: &'static str) {
pub fn set_panic_hook(program: &'static str, version: Option<String>) {
static SET_HOOK: Once = Once::new();
SET_HOOK.call_once(|| {
let default_hook = std::panic::take_hook();
@ -448,6 +448,7 @@ pub fn set_panic_hook(program: &'static str) {
.add_field_i64("one", 1)
.add_field_str("message", &ono.to_string())
.add_field_str("location", &location)
.add_field_str("version", version.as_ref().unwrap_or(&"".to_string()))
.to_owned(),
Level::Error,
);

View File

@ -2579,8 +2579,10 @@ pub fn main() {
}
solana_metrics::set_host_id(identity_keypair.pubkey().to_string());
solana_metrics::set_panic_hook("validator");
solana_metrics::set_panic_hook("validator", {
let version = format!("{:?}", solana_version::version!());
Some(version)
});
solana_entry::entry::init_poh();
snapshot_utils::remove_tmp_snapshot_archives(&snapshot_archives_dir);

View File

@ -204,7 +204,7 @@ fn get_cluster_info(
fn main() -> Result<(), Box<dyn error::Error>> {
solana_logger::setup_with_default("solana=info");
solana_metrics::set_panic_hook("watchtower");
solana_metrics::set_panic_hook("watchtower", /*version:*/ None);
let config = get_config();