Skip to content

Commit

Permalink
Fix delta should not consider reset
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Kartago Lamida <[email protected]>
  • Loading branch information
lamida committed Dec 16, 2024
1 parent 3cedd49 commit ee1b1fd
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions pkg/streamingpromql/operators/functions/rate_increase.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,16 @@ func histogramRate(isCounter, isRate bool, hCount int, hHead []promql.HPoint, hT
return nil
}

err = accumulate(hHead)
if err != nil {
return nil, err
if isCounter {
err = accumulate(hHead)
if err != nil {
return nil, err

}
err = accumulate(hTail)
if err != nil {
return nil, err
}
err = accumulate(hTail)
if err != nil {
return nil, err
}
}

if !isCounter && (firstPoint.H.CounterResetHint != histogram.GaugeType || lastPoint.H.CounterResetHint != histogram.GaugeType) {
Expand All @@ -150,11 +152,8 @@ func histogramRate(isCounter, isRate bool, hCount int, hHead []promql.HPoint, hT
delta = delta.CopyToSchema(desiredSchema)
}

if isCounter {
val := calculateHistogramRate(isRate, rangeStart, rangeEnd, rangeSeconds, firstPoint, lastPoint, delta, hCount)
return val, err
}
return delta, err
val := calculateHistogramRate(isRate, rangeStart, rangeEnd, rangeSeconds, firstPoint, lastPoint, delta, hCount)
return val, err
}

func floatRate(isCounter, isRate bool, fCount int, fHead []promql.FPoint, fTail []promql.FPoint, rangeStart int64, rangeEnd int64, rangeSeconds float64) float64 {
Expand Down

0 comments on commit ee1b1fd

Please sign in to comment.