You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 23, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 23, 2026. It is now read-only.
Float divide-by-zero silently writes +Inf/NaN to a metric (int errors): intended? #1005
Hi! Quick one, is this intended or just an oversight?
Integer divide-by-zero raises a runtime error (drops the line, bumps prog_runtime_errors_total), but float divide-by-zero doesn't. It just writes +Inf/NaN straight into the metric, no error. Same with % (Fmod gives NaN).
gauge ratio
/(?P<denom>-?\d+)/ {
ratio = 1000.0 / $denom
}
Feed it the line 0 and ratio comes out +Inf, silently. The int version (1000 / $denom) errors with Divide by zero instead, which is what made me notice.
(float($x) also happily takes "Inf"/"NaN", so you can get a non-finite metric with no division at all.)
Intended? Happy to send a small PR if not. Thanks!
Activity