app/vmselect/promql: code cleanup after 43823addea

This commit is contained in:
Aliaksandr Valialkin 2020-11-06 01:30:36 +02:00
parent 3127aa92b5
commit efebc3b6fb
3 changed files with 14 additions and 24 deletions

View file

@ -8,6 +8,9 @@
* FEATURE: vmagent: add `/ready` HTTP endpoint, which returns 200 OK status code when all the service discovery has been initialized. * FEATURE: vmagent: add `/ready` HTTP endpoint, which returns 200 OK status code when all the service discovery has been initialized.
This may be useful during rolling upgrades. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/875 This may be useful during rolling upgrades. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/875
* BUGFIX: properly calculate `topk_*` and `bottomk_*` functions from [MetricsQL](https://victoriametrics.github.io/MetricsQL.html) for time series with gaps.
See https://github.com/VictoriaMetrics/VictoriaMetrics/pull/883
# [v1.45.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.45.0) # [v1.45.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.45.0)

View file

@ -737,46 +737,30 @@ func getIntK(k float64, kMax int) int {
} }
func minValue(values []float64) float64 { func minValue(values []float64) float64 {
if len(values) == 0 { min := nan
return nan for len(values) > 0 && math.IsNaN(min) {
min = values[0]
values = values[1:]
} }
aNumberFounded := false
var min float64
for _, v := range values { for _, v := range values {
if !math.IsNaN(v) && !aNumberFounded {
min = v
aNumberFounded = true
continue
}
if !math.IsNaN(v) && v < min { if !math.IsNaN(v) && v < min {
min = v min = v
} }
} }
if !aNumberFounded {
return nan
}
return min return min
} }
func maxValue(values []float64) float64 { func maxValue(values []float64) float64 {
if len(values) == 0 { max := nan
return nan for len(values) > 0 && math.IsNaN(max) {
max = values[0]
values = values[1:]
} }
aNumberFounded := false
var max float64
for _, v := range values { for _, v := range values {
if !math.IsNaN(v) && !aNumberFounded {
max = v
aNumberFounded = true
continue
}
if !math.IsNaN(v) && v > max { if !math.IsNaN(v) && v > max {
max = v max = v
} }
} }
if !aNumberFounded {
return nan
}
return max return max
} }

View file

@ -8,6 +8,9 @@
* FEATURE: vmagent: add `/ready` HTTP endpoint, which returns 200 OK status code when all the service discovery has been initialized. * FEATURE: vmagent: add `/ready` HTTP endpoint, which returns 200 OK status code when all the service discovery has been initialized.
This may be useful during rolling upgrades. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/875 This may be useful during rolling upgrades. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/875
* BUGFIX: properly calculate `topk_*` and `bottomk_*` functions from [MetricsQL](https://victoriametrics.github.io/MetricsQL.html) for time series with gaps.
See https://github.com/VictoriaMetrics/VictoriaMetrics/pull/883
# [v1.45.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.45.0) # [v1.45.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.45.0)