Add hostname to metrics on panic
This commit is contained in:
committed by
sakridge
parent
2318ffc704
commit
a206f2570d
@@ -6,6 +6,7 @@ use std::sync::mpsc::{channel, Receiver, RecvTimeoutError, Sender};
|
||||
use std::sync::{Arc, Barrier, Mutex, Once, ONCE_INIT};
|
||||
use std::thread;
|
||||
use std::time::{Duration, Instant};
|
||||
use sys_info::hostname;
|
||||
use timing;
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -219,6 +220,12 @@ pub fn set_panic_hook(program: &'static str) {
|
||||
None => "?".to_string(),
|
||||
}),
|
||||
)
|
||||
.add_field(
|
||||
"host",
|
||||
influxdb::Value::String(
|
||||
hostname().unwrap_or_else(|_| "?".to_string())
|
||||
),
|
||||
)
|
||||
.to_owned(),
|
||||
);
|
||||
// Flush metrics immediately in case the process exits immediately
|
||||
|
Reference in New Issue
Block a user