From f8fd7d83b01c63511834d2cf9cf7f8563dfccfb7 Mon Sep 17 00:00:00 2001 From: Marek Isalski Date: Mon, 3 Jan 2022 15:45:09 +0000 Subject: [PATCH] add vantage label --- src/ping.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ping.rs b/src/ping.rs index 7d59922..3c6ef35 100644 --- a/src/ping.rs +++ b/src/ping.rs @@ -33,7 +33,7 @@ lazy_static! { static ref PING_HISTOGRAM: HistogramVec = register_histogram_vec!( "ping_rtt_milliseconds", "The ping round trip time in milliseconds", - &["target", "device", "interface", "expected", "team", "priority"], + &["target", "device", "interface", "expected", "team", "priority", "vantage"], vec![ 0.125, 0.25, 0.5, 1.0, 1.5, 2.0, 2.5, 5.0, 7.5, 10.0, 15.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0, 55.0, 60.0, 65.0, 70.0, 75.0, 80.0, 90.0, 100.0, @@ -90,6 +90,7 @@ async fn handle_ping_result(result: PingFuture, host: String, hostdata: HashMap< let device = hostdata.get("device").unwrap_or(&empty); let interface = hostdata.get("interface").unwrap_or(&empty); let team = hostdata.get("team").unwrap_or(&empty); + let vantage = hostdata.get("vantage").unwrap_or(&empty); let up = "up".to_string(); let expected = hostdata.get("expected").unwrap_or(&up); @@ -102,7 +103,7 @@ async fn handle_ping_result(result: PingFuture, host: String, hostdata: HashMap< let ms = time.as_millis(); trace!("Received pong from {} after {} ms", &host, &ms); PING_HISTOGRAM - .with_label_values(&[&host, device, interface, expected, team, severity]) + .with_label_values(&[&host, device, interface, expected, team, severity, vantage]) .observe(ms as f64); //PING_COUNTER // .with_label_values(&[&host]) @@ -111,8 +112,8 @@ async fn handle_ping_result(result: PingFuture, host: String, hostdata: HashMap< None => { trace!("Received no response from {} within timeout", &host); PING_HISTOGRAM - .with_label_values(&[&host, device, interface, expected, team, severity]) - .observe(4000.0); + .with_label_values(&[&host, device, interface, expected, team, severity, vantage]) + .observe(5000.0); } };