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!
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/NaNstraight into the metric, no error. Same with%(FmodgivesNaN).Feed it the line
0andratiocomes out+Inf, silently. The int version (1000 / $denom) errors withDivide by zeroinstead, 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!