[BUGFIX] PromQL: Noinline kahanSum, to avoid compiler optimisations

Observed on go1.24.4 darwin/arm64, the compensation variable is not correctly calculated.

Note you may have to run the tests several times to see it, to get the right ordering of series.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
Bryan Boreham 2025-07-19 15:19:29 +01:00
parent 3602785a89
commit 358499f868

View File

@ -1188,6 +1188,9 @@ func funcTimestamp(vals []parser.Value, _ parser.Expressions, enh *EvalNodeHelpe
return enh.Out, nil
}
// We get incorrect results if this function is inlined; see https://github.com/prometheus/prometheus/issues/16714.
//
//go:noinline
func kahanSumInc(inc, sum, c float64) (newSum, newC float64) {
t := sum + inc
switch {