mirror of
https://github.com/zaphar/durnitisp.git
synced 2025-07-22 18:19:48 -04:00
Only record elapsed if its not 0
This commit is contained in:
parent
301bbe14fe
commit
76a5006a1f
@ -66,18 +66,21 @@ pub fn start_echo_loop(
|
||||
.send_with_timeout(MAXHOPS.flag, Some(Duration::from_millis(PINGTIMEOUT.flag))) {
|
||||
Ok(r) => match r {
|
||||
EkkoResponse::DestinationResponse(r) => {
|
||||
let elapsed = r.elapsed.as_millis();
|
||||
info!(
|
||||
"ICMP: Reply from {}: time={}ms",
|
||||
r.address.unwrap(),
|
||||
r.elapsed.as_millis(),
|
||||
elapsed,
|
||||
);
|
||||
ping_counter
|
||||
.with(&prometheus::labels! {"result" => "ok", "domain" => domain_name})
|
||||
.inc();
|
||||
if elapsed != 0 {
|
||||
ping_latency_guage
|
||||
.with(&prometheus::labels! {"domain" => domain_name})
|
||||
.set(r.elapsed.as_millis() as i64);
|
||||
}
|
||||
}
|
||||
EkkoResponse::UnreachableResponse((_, ref _code)) => {
|
||||
// If we got unreachable we need to set up a new sender.
|
||||
error!("{:?}", r);
|
||||
|
Loading…
x
Reference in New Issue
Block a user