adds validator version to set_panic_hook (#23082) (#23088)

(cherry picked from commit 78089941ff)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
This commit is contained in:
mergify[bot]
2022-02-12 02:11:14 +00:00
committed by GitHub
parent 4eca26ae50
commit 76384758d8
5 changed files with 9 additions and 6 deletions

View File

@ -431,7 +431,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();
@ -450,6 +450,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,
);