diff --git a/app/vmselect/promql/exec.go b/app/vmselect/promql/exec.go index 586717c93e..ae8f3794a5 100644 --- a/app/vmselect/promql/exec.go +++ b/app/vmselect/promql/exec.go @@ -92,7 +92,11 @@ func maySortResults(e metricsql.Expr, tss []*timeseries) bool { } switch fe.Name { case "sort", "sort_desc", - "sort_by_label", "sort_by_label_desc": + "sort_by_label", "sort_by_label_desc", + "topk", "bottomk", + "topk_max", "topk_min", "topk_avg", "topk_median", + "bottomk_max", "bottomk_min", "bottomk_avg", "bottomk_median", + "outliersk": return false default: return true diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 26aac290bc..1d866f0149 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -23,6 +23,7 @@ sort: 13 * FEATURE: publish `arm64` and `amd64` binaries for cluster version of VictoriaMetrics at [releases page](https://github.com/VictoriaMetrics/VictoriaMetrics/releases). * BUGFIX: properly handle `/api/v1/labels` and `/api/v1/label//values` queries on big `start ... end` time range. This should fix big resource usage when VictoriaMetrics is queried with [Promxy](https://github.com/jacksontj/promxy) v0.0.62 or newer versions. +* BUGFIX: do not break sort order for series returned from `topk*`, `bottomk*` and `outliersk` [MetricsQL](https://victoriametrics.github.io/MetricsQL.html) functions. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1189). * BUGFIX: vmagent: properly work with simple HTTP proxies which don't support `CONNECT` method. For example, [PushProx](https://github.com/prometheus-community/PushProx). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1179). * BUGFIX: vmagent: properly discover targets if multiple namespace selectors are put inside `kubernetes_sd_config`. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1170). * BUGFIX: vmagent: properly discover `role: endpoints` and `role: endpointslices` targets in `kubernetes_sd_config`. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1182).