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
11
src/icmp.rs
11
src/icmp.rs
@ -66,17 +66,20 @@ pub fn start_echo_loop(
|
|||||||
.send_with_timeout(MAXHOPS.flag, Some(Duration::from_millis(PINGTIMEOUT.flag))) {
|
.send_with_timeout(MAXHOPS.flag, Some(Duration::from_millis(PINGTIMEOUT.flag))) {
|
||||||
Ok(r) => match r {
|
Ok(r) => match r {
|
||||||
EkkoResponse::DestinationResponse(r) => {
|
EkkoResponse::DestinationResponse(r) => {
|
||||||
|
let elapsed = r.elapsed.as_millis();
|
||||||
info!(
|
info!(
|
||||||
"ICMP: Reply from {}: time={}ms",
|
"ICMP: Reply from {}: time={}ms",
|
||||||
r.address.unwrap(),
|
r.address.unwrap(),
|
||||||
r.elapsed.as_millis(),
|
elapsed,
|
||||||
);
|
);
|
||||||
ping_counter
|
ping_counter
|
||||||
.with(&prometheus::labels! {"result" => "ok", "domain" => domain_name})
|
.with(&prometheus::labels! {"result" => "ok", "domain" => domain_name})
|
||||||
.inc();
|
.inc();
|
||||||
ping_latency_guage
|
if elapsed != 0 {
|
||||||
.with(&prometheus::labels! {"domain" => domain_name})
|
ping_latency_guage
|
||||||
.set(r.elapsed.as_millis() as i64);
|
.with(&prometheus::labels! {"domain" => domain_name})
|
||||||
|
.set(r.elapsed.as_millis() as i64);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EkkoResponse::UnreachableResponse((_, ref _code)) => {
|
EkkoResponse::UnreachableResponse((_, ref _code)) => {
|
||||||
// If we got unreachable we need to set up a new sender.
|
// If we got unreachable we need to set up a new sender.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user