app/vmselect/promql: keep metric name in rollup_candlestick results, since they don't change the original series meaning

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1600
This commit is contained in:
Aliaksandr Valialkin 2021-09-09 19:21:16 +03:00
parent dca6f0f7de
commit 9b07cb2988
3 changed files with 7 additions and 1 deletions

View file

@ -6252,12 +6252,13 @@ func TestExecSuccess(t *testing.T) {
})
t.Run(`rollup_candlestick()`, func(t *testing.T) {
t.Parallel()
q := `sort(rollup_candlestick(round(rand(0),0.01)[:10s]))`
q := `sort(rollup_candlestick(alias(round(rand(0),0.01),"foobar")[:10s]))`
r1 := netstorage.Result{
MetricName: metricNameExpected,
Values: []float64{0.02, 0.02, 0.03, 0, 0.03, 0.02},
Timestamps: timestampsExpected,
}
r1.MetricName.MetricGroup = []byte("foobar")
r1.MetricName.Tags = []storage.Tag{{
Key: []byte("rollup"),
Value: []byte("low"),
@ -6267,6 +6268,7 @@ func TestExecSuccess(t *testing.T) {
Values: []float64{0.9, 0.32, 0.82, 0.13, 0.28, 0.86},
Timestamps: timestampsExpected,
}
r2.MetricName.MetricGroup = []byte("foobar")
r2.MetricName.Tags = []storage.Tag{{
Key: []byte("rollup"),
Value: []byte("open"),
@ -6276,6 +6278,7 @@ func TestExecSuccess(t *testing.T) {
Values: []float64{0.1, 0.04, 0.49, 0.46, 0.57, 0.92},
Timestamps: timestampsExpected,
}
r3.MetricName.MetricGroup = []byte("foobar")
r3.MetricName.Tags = []storage.Tag{{
Key: []byte("rollup"),
Value: []byte("close"),
@ -6285,6 +6288,7 @@ func TestExecSuccess(t *testing.T) {
Values: []float64{0.9, 0.94, 0.97, 0.93, 0.98, 0.92},
Timestamps: timestampsExpected,
}
r4.MetricName.MetricGroup = []byte("foobar")
r4.MetricName.Tags = []storage.Tag{{
Key: []byte("rollup"),
Value: []byte("high"),

View file

@ -198,6 +198,7 @@ var rollupFuncsKeepMetricGroup = map[string]bool{
"first_over_time": true,
"last_over_time": true,
"mode_over_time": true,
"rollup_candlestick": true,
}
func getRollupAggrFuncNames(expr metricsql.Expr) ([]string, error) {

View file

@ -13,6 +13,7 @@ sort: 15
* FAETURE: allow splitting long `regex` in relabeling filters into an array of shorter regexps, which can be put into multiple lines for better readability and maintainability. See [these docs](https://docs.victoriametrics.com/vmagent.html#relabeling) for more details.
* BUGFIX: vmselect: reset connection timeouts after each request to `vmstorage`. This should prevent from `cannot read data in 0.000 seconds: unexpected EOF` warning in logs. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1562). Thanks to @mxlxm .
* BUGFIX: keep metric name for time series returned from [rollup_candlestick](https://docs.victoriametrics.com/MetricsQL.html#rollup_candlestick) function, since the returned series don't change the meaning of the original series. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1600).
## [v1.65.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.65.0)