Skip to content

Commit

Permalink
app/vmselect/promql: properly handle Prometheus staleness marks in re…
Browse files Browse the repository at this point in the history
…moveCounterResets functions

Prometheus stalenss marks shouldn't be changed in removeCounterResets. Otherwise they will be converted to an ordinary NaN values,
which couldn't be removed in dropStaleNaNs() function later. This may result in incorrect calculations for rollup functions.

Updates #1526
  • Loading branch information
valyala committed Aug 14, 2021
1 parent 7d0e64d commit af4a306
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/vmselect/promql/rollup.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,6 @@ func getMaxPrevInterval(scrapeInterval int64) int64 {
}

func removeCounterResets(values []float64) {
// There is no need in handling NaNs here, since they are impossible
// on values from vmstorage.
if len(values) == 0 {
return
}
Expand All @@ -723,7 +721,9 @@ func removeCounterResets(values []float64) {
}
}
prevValue = v
values[i] = v + correction
if !decimal.IsStaleNaN(v) {
values[i] = v + correction
}
}
}

Expand Down

0 comments on commit af4a306

Please sign in to comment.