Fix avg_over_time for nan and float64 overflows#7346
Fix avg_over_time for nan and float64 overflows#7346roidelapluie merged 5 commits intoprometheus:masterfrom
Conversation
82fd866 to
73acd18
Compare
0a140f5 to
095e110
Compare
51d9eaf to
3035580
Compare
|
Can you explain more what this is trying to do, and if/how it varies from the naieve algorithm? |
|
It fixes avg_over_time for Inf + avg_over_time for float64 that would otherwise overflow the float64. e.g. the following tests would fail otherwise: |
|
I will make the comments cleaerer |
|
What are those returning now? Does |
Current behaviourNew |
|
Why is metric10 changing? |
|
It is one big positive and one big negative float that average to 0 |
|
Previously (v.V - mean ) / count would overlow to (Inf) / count => Int |
9d82767 to
b86fcb3
Compare
|
|
b86fcb3 to
d0f9ad6
Compare
|
@brian-brazil are we interested by this fix? |
promql/engine.go
Outdated
| if math.IsInf(group.mean, 0) { | ||
| if math.IsInf(s.V, 0) && (group.mean > 0) == (s.V > 0) { | ||
| // The `mean` and `s.V` values are `Inf` of the same sign. They | ||
| // can't be substracted, but the value of `mean` is correct |
promql/engine.go
Outdated
| break | ||
| } | ||
| if !math.IsInf(s.V, 0) && !math.IsNaN(s.V) { | ||
| // It the mean is an `Inf`, avoid removing an `Inf` with |
There was a problem hiding this comment.
I don't understand this comment.
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
d0f9ad6 to
fbf12fc
Compare
|
I have adapted the comment and rebased on top of group(). |
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
promql/engine.go
Outdated
| break | ||
| } | ||
| if !math.IsInf(s.V, 0) && !math.IsNaN(s.V) { | ||
| // At this stage, the mean is an infinite. It the added |
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
Signed-off-by: Julien Pivotto roidelapluie@inuits.eu