app/vmselect/promql: do not merge time series during requests to /api/v1/query

See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1141
This commit is contained in:
Aliaksandr Valialkin 2021-03-25 13:55:54 +02:00
parent 6e855d4b82
commit 0b2a66db30
2 changed files with 7 additions and 0 deletions

View file

@ -267,6 +267,12 @@ func mergeNonOverlappingTimeseries(dst, src *timeseries) bool {
if overlaps > 2 { if overlaps > 2 {
return false return false
} }
// Do not merge time series with too small number of datapoints.
// This can be the case during evaluation of instant queries (alerting or recording rules).
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1141
if len(srcValues) <= 2 && len(dstValues) <= 2 {
return false
}
// Time series can be merged. Merge them. // Time series can be merged. Merge them.
for i, v := range srcValues { for i, v := range srcValues {
if math.IsNaN(v) { if math.IsNaN(v) {

View file

@ -14,6 +14,7 @@
* BUGFIX: prevent from infinite loop on `{__graphite__="..."}` filters when a metric name contains `*`, `{` or `[` chars. * BUGFIX: prevent from infinite loop on `{__graphite__="..."}` filters when a metric name contains `*`, `{` or `[` chars.
* BUGFIX: prevent from infinite loop in `/metrics/find` and `/metrics/expand` [Graphite Metrics API handlers](https://victoriametrics.github.io/#graphite-metrics-api-usage) when they match metric names or labels with `*`, `{` or `[` chars. * BUGFIX: prevent from infinite loop in `/metrics/find` and `/metrics/expand` [Graphite Metrics API handlers](https://victoriametrics.github.io/#graphite-metrics-api-usage) when they match metric names or labels with `*`, `{` or `[` chars.
* BUGFIX: do not merge duplicate time series during requests to `/api/v1/query`. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1141
# [v1.56.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.56.0) # [v1.56.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.56.0)