Ping input doesn't return response time metric when timeout
This commit is contained in:
parent
2ec1ffdc11
commit
3a73ed843a
|
@ -86,7 +86,9 @@ func (p *Ping) Gather(acc inputs.Accumulator) error {
|
|||
"packets_transmitted": trans,
|
||||
"packets_received": rec,
|
||||
"percent_packet_loss": loss,
|
||||
"average_response_ms": avg,
|
||||
}
|
||||
if avg > 0 {
|
||||
fields["average_response_ms"] = avg
|
||||
}
|
||||
acc.AddFields("ping", fields, tags)
|
||||
}(url, acc)
|
||||
|
|
|
@ -193,7 +193,6 @@ func TestBadPingGather(t *testing.T) {
|
|||
"packets_transmitted": 2,
|
||||
"packets_received": 0,
|
||||
"percent_packet_loss": 100.0,
|
||||
"average_response_ms": 0.0,
|
||||
}
|
||||
acc.AssertContainsTaggedFields(t, "ping", fields, tags)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue