mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vmselect/promql: fix panic when calculating aggr_func(rollup*())
The panic has been introduced in dac21d874b
This commit is contained in:
parent
ac4c7adec6
commit
b3bb18d674
2 changed files with 15 additions and 1 deletions
|
@ -282,10 +282,23 @@ func getRollupAggrFuncNames(expr metricsql.Expr) ([]string, error) {
|
||||||
return aggrFuncNames, nil
|
return aggrFuncNames, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getRollupTag returns the possible second arg from the expr.
|
||||||
|
//
|
||||||
|
// The expr can have the following forms:
|
||||||
|
// - rollup_func(q, tag)
|
||||||
|
// - aggr_func(rollup_func(q, tag)) - this form is used during incremental aggregate calculations
|
||||||
func getRollupTag(expr metricsql.Expr) (string, error) {
|
func getRollupTag(expr metricsql.Expr) (string, error) {
|
||||||
|
af, ok := expr.(*metricsql.AggrFuncExpr)
|
||||||
|
if ok {
|
||||||
|
// extract rollup_func() from aggr_func(rollup_func(q, tag))
|
||||||
|
if len(af.Args) != 1 {
|
||||||
|
logger.Panicf("BUG: unexpected number of args to %s; got %d; want 1", af.AppendString(nil), len(af.Args))
|
||||||
|
}
|
||||||
|
expr = af.Args[0]
|
||||||
|
}
|
||||||
fe, ok := expr.(*metricsql.FuncExpr)
|
fe, ok := expr.(*metricsql.FuncExpr)
|
||||||
if !ok {
|
if !ok {
|
||||||
logger.Panicf("BUG: unexpected expression; want metricsql.FuncExpr; got %T; value: %s", expr, expr.AppendString(nil))
|
logger.Panicf("BUG: unexpected expression; want *metricsql.FuncExpr; got %T; value: %s", expr, expr.AppendString(nil))
|
||||||
}
|
}
|
||||||
if len(fe.Args) < 2 {
|
if len(fe.Args) < 2 {
|
||||||
return "", nil
|
return "", nil
|
||||||
|
|
|
@ -15,6 +15,7 @@ The following tip changes can be tested by building VictoriaMetrics components f
|
||||||
|
|
||||||
## tip
|
## tip
|
||||||
|
|
||||||
|
* BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): fix panic when executing the query `aggr_func(rollup*(some_value))`. The panic has been introduced in [v1.88.0](https://docs.victoriametrics.com/CHANGELOG.html#v1880).
|
||||||
* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): use the provided `-remoteWrite.*` auth options when determining whether the remote storage supports [VictoriaMetrics remote write protocol](https://docs.victoriametrics.com/vmagent.html#victoriametrics-remote-write-protocol). Previously the auth options were ignored. This was preventing from automatic switch to VictoriaMetrics remote write protocol.
|
* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): use the provided `-remoteWrite.*` auth options when determining whether the remote storage supports [VictoriaMetrics remote write protocol](https://docs.victoriametrics.com/vmagent.html#victoriametrics-remote-write-protocol). Previously the auth options were ignored. This was preventing from automatic switch to VictoriaMetrics remote write protocol.
|
||||||
* BUGFIX: [vmctl](https://docs.victoriametrics.com/vmctl.html): skip measurements with no fields when migrating data from influxdb. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3837).
|
* BUGFIX: [vmctl](https://docs.victoriametrics.com/vmctl.html): skip measurements with no fields when migrating data from influxdb. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3837).
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue