Skip to content

Commit

Permalink
No need to compare first point in head with itself
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Kartago Lamida <[email protected]>
  • Loading branch information
lamida committed Oct 31, 2024
1 parent 5953f39 commit bed565f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/streamingpromql/operators/functions/range_vectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,12 @@ func changes(step types.RangeVectorStepData, _ float64, _ types.EmitAnnotationFu
// The points buffer is wrapped around, therefore we need to check changes starting from the buffer's head
// and then continue to the tail.
if len(fHead) > 0 && len(fTail) > 0 {
accumulate(fHead, pPrev)
accumulate(fHead[1:], pPrev)
accumulate(fTail, pPrev)
}

if len(fHead) > 0 && len(fTail) == 0 {
accumulate(fHead, pPrev)
accumulate(fHead[1:], pPrev)
}
return changes, true, nil, nil
}

0 comments on commit bed565f

Please sign in to comment.