Skip to content

Omit probe_icmp_duration rtt metric when echo reply is missing - #1635

Open
locker95 wants to merge 1 commit into
prometheus:masterfrom
locker95:fix/984-icmp-rtt-on-failure
Open

Omit probe_icmp_duration rtt metric when echo reply is missing#1635
locker95 wants to merge 1 commit into
prometheus:masterfrom
locker95:fix/984-icmp-rtt-on-failure

Conversation

@locker95

Copy link
Copy Markdown

Description

probe_icmp_duration_seconds{phase="rtt"} was pre-created for every probe, so a missing echo reply exported 0. That looks like an instant success and pollutes range aggregations:

  • avg_over_time(...[5m])
  • min_over_time(...[5m])
  • quantile_over_time(...)

A failed RTT is not zero latency. Prefer not exporting the series when there is no reply (same idea as skipping probe_icmp_reply_hop_limit when TTL is unavailable).

Behavior change: on failed ICMP probes, phase="rtt" is absent instead of 0. resolve / setup are unchanged. Successful probes still export a positive rtt.

Dashboards that assumed rtt is always present should treat a missing series as “no sample” (Prometheus range aggregations already skip gaps).

Fixes #984

How to verify

go test ./prober/ -run TestProbeICMPDurationRTT -count=1 -v
[BUGFIX] Do not export probe_icmp_duration_seconds{phase="rtt"}=0 when the echo reply is missing #984

phase="rtt" was pre-created at 0 for every probe. Failed pings therefore
exported rtt=0, which looks like an instant success and skews
avg_over_time / quantiles / min_over_time over mixed success and loss.

Only export phase="rtt" when a matching echo reply is received. resolve
and setup phases are unchanged. Successful probes still report a positive
rtt.

Behavior change: on probe_success=0, probe_icmp_duration_seconds{phase="rtt"}
is absent instead of 0. Aggregations that only care about successful RTTs
no longer need subqueries to filter zeros.

Fixes prometheus#984

Signed-off-by: Dean Chen <862469039@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

probe_icmp_duration{phase="rtt"} returns 0 for failed packets

1 participant