MCPcopy
hub / github.com/grafana/tempo / sumOverTime

Function sumOverTime

pkg/traceql/engine_metrics_functions.go:5–16  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import "math"
4
5func sumOverTime() func(curr float64, n float64) (res float64) {
6 var comp float64 // Kahan compensation
7 return func(sum, inc float64) (res float64) {
8 if math.IsNaN(sum) {
9 return inc
10 }
11 y := inc - comp
12 sum, c := kahanSumInc(y, sum, 0) // Compensation is applied on every step, hence we pass 0 to reset it
13 comp = c
14 return sum
15 }
16}
17
18func minOverTime() func(curr float64, n float64) (res float64) {
19 return func(curr, n float64) (res float64) {

Callers 2

NewOverTimeAggregatorFunction · 0.85
NewSimpleCombinerFunction · 0.85

Calls 1

kahanSumIncFunction · 0.85

Tested by

no test coverage detected