prometheus/promql/promqltest/testdata
beorn7 c46074f4dd promql: make avg aggregation more precise and less expensive
The basic idea here is that the previous code was always doing
incremental calculation of the mean value, which is more costly and
can be less precise. It protects against overflows, but in most cases,
an overflow doesn't happen anyway.

The other idea applied here is to expand on #14074, where Kahan
summation was applied to sum().

With this commit, the average is calculated in a conventional way
(adding everything up and divide in the end) as long as the sum isn't
overflowing float64. This is combined with Kahan summation so that the
avg aggregation, in most cases, is really equivalent to the sum
aggregation with a following division (which is the user's expectation
as avg is supposed to be syntactic sugar for sum with a following
divison).

If the sum hits ±Inf, the calculation reverts to incremental
calculation of the mean value. Kahan summation is also applied here,
although it cannot fully compensate for the numerical errors
introduced by the incremental mean calculation. (The tests added in
this commit would fail if incremental mean calculation was always
used.)

Signed-off-by: beorn7 <beorn@grafana.com>
2024-07-10 19:20:24 +02:00
..
aggregators.test promql: make avg aggregation more precise and less expensive 2024-07-10 19:20:24 +02:00
at_modifier.test test: move test files into new promqltest package 2024-05-08 13:42:55 +01:00
collision.test test: move test files into new promqltest package 2024-05-08 13:42:55 +01:00
functions.test Merge branch 'main' into nhcb-review-2 2024-06-20 22:50:00 +08:00
histograms.test remove eval_with_nhcb 2024-06-20 22:49:00 +08:00
limit.test feat: add limitk() and limit_ratio() operators (#12503) 2024-07-03 22:18:57 +02:00
literals.test test: move test files into new promqltest package 2024-05-08 13:42:55 +01:00
native_histograms.test Merge pull request #14362 from charleskorn/charleskorn/sum-infinity 2024-07-03 01:05:03 -04:00
operators.test test: move test files into new promqltest package 2024-05-08 13:42:55 +01:00
range_queries.test Convert range query test cases to test scripting language 2024-06-17 16:43:01 +10:00
selectors.test test: move test files into new promqltest package 2024-05-08 13:42:55 +01:00
staleness.test test: move test files into new promqltest package 2024-05-08 13:42:55 +01:00
subquery.test test: move test files into new promqltest package 2024-05-08 13:42:55 +01:00
trig_functions.test test: move test files into new promqltest package 2024-05-08 13:42:55 +01:00