app/vmselect/promql: return the last timestamp for the max / min value from tmax_over_time() and tmin_over_time() function as most users expect

This commit is contained in:
Aliaksandr Valialkin 2021-06-23 14:18:13 +03:00
parent dffa2afefe
commit 856aecae05
2 changed files with 5 additions and 2 deletions

View file

@ -1149,7 +1149,8 @@ func rollupTmin(rfa *rollupFuncArg) float64 {
minValue := values[0] minValue := values[0]
minTimestamp := timestamps[0] minTimestamp := timestamps[0]
for i, v := range values { for i, v := range values {
if v < minValue { // Get the last timestamp for the minimum value as most users expect.
if v <= minValue {
minValue = v minValue = v
minTimestamp = timestamps[i] minTimestamp = timestamps[i]
} }
@ -1168,7 +1169,8 @@ func rollupTmax(rfa *rollupFuncArg) float64 {
maxValue := values[0] maxValue := values[0]
maxTimestamp := timestamps[0] maxTimestamp := timestamps[0]
for i, v := range values { for i, v := range values {
if v > maxValue { // Get the last timestamp for the maximum value as most users expect.
if v >= maxValue {
maxValue = v maxValue = v
maxTimestamp = timestamps[i] maxTimestamp = timestamps[i]
} }

View file

@ -20,6 +20,7 @@ sort: 15
* BUGFIX: prevent from adding new samples to deleted time series after the rotation of the inverted index (the rotation is performed once per `-retentionPeriod`). See [this comment](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1347#issuecomment-861232136) for details. * BUGFIX: prevent from adding new samples to deleted time series after the rotation of the inverted index (the rotation is performed once per `-retentionPeriod`). See [this comment](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1347#issuecomment-861232136) for details.
* BUGFIX: vmstorage: reduce high disk write IO usage on systems with big number of CPU cores. The issue has been introduced in the release [v1.59.0](#v1590). See [this commit](aa9b56a046b6ae8083fa659df35dd5e994bf9115) and [this comment](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1338#issuecomment-863046999) for details. * BUGFIX: vmstorage: reduce high disk write IO usage on systems with big number of CPU cores. The issue has been introduced in the release [v1.59.0](#v1590). See [this commit](aa9b56a046b6ae8083fa659df35dd5e994bf9115) and [this comment](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1338#issuecomment-863046999) for details.
* BUGFIX: vmstorage: prevent from incorrect stats collection when multiple concurrent queries execute the same tag filter. This may help reducing CPU usage under certain workloads. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1338). * BUGFIX: vmstorage: prevent from incorrect stats collection when multiple concurrent queries execute the same tag filter. This may help reducing CPU usage under certain workloads. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1338).
* BUGFIX: vmselect: return the last timestamp for the max / min value from `tmax_over_time(m[d])` and `tmin_over_time(m[d])` [MetricsQL functions](https://docs.victoriametrics.com/MetricsQL.html) as most users expect. See also [this issue](https://github.com/prometheus/prometheus/issues/8966).
## [v1.61.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.61.1) ## [v1.61.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.61.1)