vendor: update github.com/VictoriaMetrics/metricsql from v0.70.0 to v0.70.1

This should help with the https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5604
This commit is contained in:
Aliaksandr Valialkin 2024-02-06 21:52:32 +02:00
parent e159cc30df
commit 61524ad87b
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB
6 changed files with 40 additions and 9 deletions

View file

@ -33,6 +33,8 @@ The sandbox cluster installation is running under the constant load generated by
* FEATURE: [dashboards/vmagent](https://grafana.com/grafana/dashboards/12683): add `Targets scraped/s` stat panel showing the number of targets scraped by the vmagent per-second.
* FEATURE: [dashboards/all](https://grafana.com/orgs/victoriametrics): add new panel `CPU spent on GC`. It should help identifying cases when too much CPU is spent on garbage collection, and advice users on how this can be addressed.
* BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly propagate [label filters](https://docs.victoriametrics.com/keyconcepts/#filtering) from multiple arguments passed to [aggregate functions](https://docs.victoriametrics.com/metricsql/#aggregate-functions). For example, `sum({job="foo"}, {job="bar"}) by (job) + a` was improperly optimized to `sum({job="foo"}, {job="bar"}) by (job) + a{job="foo"}` before being executed. This could lead to unexpected results. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5604).
## [v1.97.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.97.1)
Released at 2024-02-01

2
go.mod
View file

@ -9,7 +9,7 @@ require (
github.com/VictoriaMetrics/easyproto v0.1.4
github.com/VictoriaMetrics/fastcache v1.12.2
github.com/VictoriaMetrics/metrics v1.31.0
github.com/VictoriaMetrics/metricsql v0.70.0
github.com/VictoriaMetrics/metricsql v0.70.1
github.com/aws/aws-sdk-go-v2 v1.24.1
github.com/aws/aws-sdk-go-v2/config v1.26.6
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.15.15

4
go.sum
View file

@ -66,8 +66,8 @@ github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkT
github.com/VictoriaMetrics/metrics v1.24.0/go.mod h1:eFT25kvsTidQFHb6U0oa0rTrDRdz4xTYjpL8+UPohys=
github.com/VictoriaMetrics/metrics v1.31.0 h1:X6+nBvAP0UB+GjR0Ht9hhQ3pjL1AN4b8dt9zFfzTsUo=
github.com/VictoriaMetrics/metrics v1.31.0/go.mod h1:r7hveu6xMdUACXvB8TYdAj8WEsKzWB0EkpJN+RDtOf8=
github.com/VictoriaMetrics/metricsql v0.70.0 h1:G0k/m1yAF6pmk0dM3VT9/XI5PZ8dL7EbcLhREf4bgeI=
github.com/VictoriaMetrics/metricsql v0.70.0/go.mod h1:k4UaP/+CjuZslIjd+kCigNG9TQmUqh5v0TP/nMEy90I=
github.com/VictoriaMetrics/metricsql v0.70.1 h1:9WneeSk9HAGf9E8qZmuPnE3KaflBpVkrLjpPtbAlzoU=
github.com/VictoriaMetrics/metricsql v0.70.1/go.mod h1:k4UaP/+CjuZslIjd+kCigNG9TQmUqh5v0TP/nMEy90I=
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=

View file

@ -88,7 +88,16 @@ func getCommonLabelFilters(e Expr) []LabelFilter {
}
return getCommonLabelFilters(arg)
case *AggrFuncExpr:
arg := getFuncArgForOptimization(t.Name, t.Args)
args := t.Args
if len(args) > 0 && canAcceptMultipleArgsForAggrFunc(t.Name) {
lfs := getCommonLabelFilters(args[0])
for _, arg := range args[1:] {
lfsNext := getCommonLabelFilters(arg)
lfs = intersectLabelFilters(lfs, lfsNext)
}
return trimFiltersByAggrModifier(lfs, t)
}
arg := getFuncArgForOptimization(t.Name, args)
if arg == nil {
return nil
}
@ -242,9 +251,16 @@ func pushdownBinaryOpFiltersInplace(e Expr, lfs []LabelFilter) {
}
case *AggrFuncExpr:
lfs = trimFiltersByAggrModifier(lfs, t)
arg := getFuncArgForOptimization(t.Name, t.Args)
if arg != nil {
pushdownBinaryOpFiltersInplace(arg, lfs)
args := t.Args
if len(args) > 0 && canAcceptMultipleArgsForAggrFunc(t.Name) {
for _, arg := range args {
pushdownBinaryOpFiltersInplace(arg, lfs)
}
} else {
arg := getFuncArgForOptimization(t.Name, args)
if arg != nil {
pushdownBinaryOpFiltersInplace(arg, lfs)
}
}
case *BinaryOpExpr:
lfs = TrimFiltersByGroupModifier(lfs, t)
@ -379,10 +395,23 @@ func getAggrArgIdxForOptimization(funcName string, args []Expr) int {
case "quantiles":
return len(args) - 1
default:
if len(args) > 1 && canAcceptMultipleArgsForAggrFunc(funcName) {
panic(fmt.Errorf("BUG: %d > 1 args passed to aggregate function %q; this case must be already handled", len(args), funcName))
}
return 0
}
}
func canAcceptMultipleArgsForAggrFunc(funcName string) bool {
switch strings.ToLower(funcName) {
case "any", "avg", "count", "distinct", "geomean", "group", "histogram", "mad", "max",
"median", "min", "mode", "share", "stddev", "stdvar", "sum", "sum2", "zscore":
return true
default:
return false
}
}
func getRollupArgIdxForOptimization(funcName string, args []Expr) int {
// This must be kept in sync with GetRollupArgIdx()
switch strings.ToLower(funcName) {

View file

@ -24,9 +24,9 @@ var transformFuncs = map[string]bool{
"clamp_min": true,
"cos": true,
"cosh": true,
"day_of_year": true,
"day_of_month": true,
"day_of_week": true,
"day_of_year": true,
"days_in_month": true,
"deg": true,
"drop_common_labels": true,

2
vendor/modules.txt vendored
View file

@ -102,7 +102,7 @@ github.com/VictoriaMetrics/fastcache
# github.com/VictoriaMetrics/metrics v1.31.0
## explicit; go 1.17
github.com/VictoriaMetrics/metrics
# github.com/VictoriaMetrics/metricsql v0.70.0
# github.com/VictoriaMetrics/metricsql v0.70.1
## explicit; go 1.13
github.com/VictoriaMetrics/metricsql
github.com/VictoriaMetrics/metricsql/binaryop