mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-06-18 00:03:47 +03:00
vendor: update github.com/VictoriaMetrics/metricsql from v0.83.1 to v0.84.0
The new version of github.com/VictoriaMetrics/metricsql handles $__interval and $__rate_interval inside rollup functions in more correct way - it drops square brakets, so VictoriaMetrics could automatically detect the needed lookbehind window depending on the time distance between real samples. For example, rate(m[$__rate_interval]) is parsed and processed as rate(m) now.
This commit is contained in:
committed by
f41gh7
parent
d56f9327ec
commit
eacd3c11ff
@@ -33,6 +33,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/).
|
||||
* FEATURE: [vmui](https://docs.victoriametrics.com/#vmui): print full error messages for failed queries on the `Explore Cardinality` page. Before, only response status code was printed.
|
||||
* FEATURE: [vmui](https://docs.victoriametrics.com/#vmui): move values representing changes relative to the previous day to a separate column for easier sorting on the `Explore Cardinality` page.
|
||||
* FEATURE: [MetricsQL](https://docs.victoriametrics.com/metricsql/): support auto-format (prettify) for expressions that use quoted metric or label names. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7703) for details.
|
||||
* FEATURE: [MetricsQL](https://docs.victoriametrics.com/metricsql/): parse `$__interval` and `$__rate_interval` inside square brackets as missing square brackets. For example, `rate(m[$__interval])` is parsed as `rate(m)` instead of `rate(m[1i])`. This enables automatic detection of the lookbehind window for [rollup functions](https://docs.victoriametrics.com/metricsql/#rollup-functions) by VictoriaMetrics, which usually returns the most expected result.
|
||||
|
||||
* BUGFIX: all the VictoriaMetrics components: properly override basic authorization for API endpoints protected with `authKey`. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7345#issuecomment-2662595807) for details.
|
||||
* BUGFIX: [vmalert](https://docs.victoriametrics.com/vmalert/): fix polluted alert messages when multiple Alertmanager instances are configured with `alert_relabel_configs`. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/8040), and thanks to @evkuzin for [the pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/8258).
|
||||
|
||||
2
go.mod
2
go.mod
@@ -15,7 +15,7 @@ require (
|
||||
github.com/VictoriaMetrics/easyproto v0.1.4
|
||||
github.com/VictoriaMetrics/fastcache v1.12.2
|
||||
github.com/VictoriaMetrics/metrics v1.35.2
|
||||
github.com/VictoriaMetrics/metricsql v0.83.1
|
||||
github.com/VictoriaMetrics/metricsql v0.84.0
|
||||
github.com/aws/aws-sdk-go-v2 v1.36.1
|
||||
github.com/aws/aws-sdk-go-v2/config v1.29.6
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.61
|
||||
|
||||
6
go.sum
6
go.sum
@@ -43,10 +43,8 @@ github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkT
|
||||
github.com/VictoriaMetrics/metrics v1.34.0/go.mod h1:r7hveu6xMdUACXvB8TYdAj8WEsKzWB0EkpJN+RDtOf8=
|
||||
github.com/VictoriaMetrics/metrics v1.35.2 h1:Bj6L6ExfnakZKYPpi7mGUnkJP4NGQz2v5wiChhXNyWQ=
|
||||
github.com/VictoriaMetrics/metrics v1.35.2/go.mod h1:r7hveu6xMdUACXvB8TYdAj8WEsKzWB0EkpJN+RDtOf8=
|
||||
github.com/VictoriaMetrics/metricsql v0.83.0 h1:3460jZ97XWD+595jpPdtVTVoKJflbxqBgeCbzPCiSgU=
|
||||
github.com/VictoriaMetrics/metricsql v0.83.0/go.mod h1:1g4hdCwlbJZ851PU9VN65xy9Rdlzupo6fx3SNZ8Z64U=
|
||||
github.com/VictoriaMetrics/metricsql v0.83.1 h1:+eHBVsYJvOPw8oy25gh1VT7OnT+jtfHb31eGvfYNEkY=
|
||||
github.com/VictoriaMetrics/metricsql v0.83.1/go.mod h1:1g4hdCwlbJZ851PU9VN65xy9Rdlzupo6fx3SNZ8Z64U=
|
||||
github.com/VictoriaMetrics/metricsql v0.84.0 h1:rVZapkXHiM4dR979La3tk8u2equ57Insbr1+Hm6yUew=
|
||||
github.com/VictoriaMetrics/metricsql v0.84.0/go.mod h1:1g4hdCwlbJZ851PU9VN65xy9Rdlzupo6fx3SNZ8Z64U=
|
||||
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
|
||||
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
|
||||
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b h1:mimo19zliBX/vSQ6PWWSL9lK8qwHozUj03+zLoEB8O0=
|
||||
|
||||
18
vendor/github.com/VictoriaMetrics/metricsql/lexer.go
generated
vendored
18
vendor/github.com/VictoriaMetrics/metricsql/lexer.go
generated
vendored
@@ -123,16 +123,12 @@ again:
|
||||
goto tokenFoundLabel
|
||||
}
|
||||
if strings.HasPrefix(s, "$__interval") {
|
||||
// Automatically replace $__interval with 1i.
|
||||
// This allows running copy-n-pasted queries from Grafana.
|
||||
lex.sTail = s[len("$__interval"):]
|
||||
return "1i", nil
|
||||
return "$__interval", nil
|
||||
}
|
||||
if strings.HasPrefix(s, "$__rate_interval") {
|
||||
// Automatically replace $__rate_interval with 1i.
|
||||
// This allows running copy-n-pasted queries from Grafana.
|
||||
lex.sTail = s[len("$__rate_interval"):]
|
||||
return "1i", nil
|
||||
return "$__interval", nil
|
||||
}
|
||||
return "", fmt.Errorf("cannot recognize %q", s)
|
||||
|
||||
@@ -538,6 +534,9 @@ func scanSpecialIntegerPrefix(s string) (skipChars int, isHex bool) {
|
||||
}
|
||||
|
||||
func isPositiveDuration(s string) bool {
|
||||
if s == "$__interval" {
|
||||
return true
|
||||
}
|
||||
n := scanDuration(s)
|
||||
return n == len(s)
|
||||
}
|
||||
@@ -606,6 +605,10 @@ func DurationValue(s string, step int64) (int64, error) {
|
||||
}
|
||||
|
||||
func parseSingleDuration(s string, step int64) (float64, error) {
|
||||
if s == "$__interval" {
|
||||
return float64(step), nil
|
||||
}
|
||||
|
||||
s = strings.ToLower(s)
|
||||
numPart := s[:len(s)-1]
|
||||
// Strip trailing m if the duration is in ms
|
||||
@@ -668,6 +671,9 @@ func scanSingleDuration(s string, canBeNegative bool) int {
|
||||
if s[0] == '-' && canBeNegative {
|
||||
i++
|
||||
}
|
||||
if s[i:] == "$__interval" {
|
||||
return i + len("$__interval")
|
||||
}
|
||||
for i < len(s) && isDecimalChar(s[i]) {
|
||||
i++
|
||||
}
|
||||
|
||||
13
vendor/github.com/VictoriaMetrics/metricsql/parser.go
generated
vendored
13
vendor/github.com/VictoriaMetrics/metricsql/parser.go
generated
vendored
@@ -1512,7 +1512,15 @@ func (p *parser) parseWindowAndStep() (*DurationExpr, *DurationExpr, bool, error
|
||||
}
|
||||
var window *DurationExpr
|
||||
if !strings.HasPrefix(p.lex.Token, ":") {
|
||||
window, err = p.parsePositiveDuration()
|
||||
if p.lex.Token == "$__interval" {
|
||||
// Skip $__interval, since it must be treated as missing lookbehind window,
|
||||
// e.g. rate(m[$__interval]) must be equivalent to rate(m).
|
||||
// In this case VictoriaMetrics automatically adjusts the lookbehind window
|
||||
// to the interval between samples.
|
||||
err = p.lex.Next()
|
||||
} else {
|
||||
window, err = p.parsePositiveDuration()
|
||||
}
|
||||
if err != nil {
|
||||
return nil, nil, false, err
|
||||
}
|
||||
@@ -1626,6 +1634,9 @@ func (p *parser) parsePositiveDuration() (*DurationExpr, error) {
|
||||
if _, err := DurationValue(s, 0); err != nil {
|
||||
return nil, fmt.Errorf(`duration: parse value error: %q: %w`, s, err)
|
||||
}
|
||||
if s == "$__interval" {
|
||||
s = "1i"
|
||||
}
|
||||
de := &DurationExpr{
|
||||
s: s,
|
||||
}
|
||||
|
||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -119,7 +119,7 @@ github.com/VictoriaMetrics/fastcache
|
||||
# github.com/VictoriaMetrics/metrics v1.35.2
|
||||
## explicit; go 1.17
|
||||
github.com/VictoriaMetrics/metrics
|
||||
# github.com/VictoriaMetrics/metricsql v0.83.1
|
||||
# github.com/VictoriaMetrics/metricsql v0.84.0
|
||||
## explicit; go 1.13
|
||||
github.com/VictoriaMetrics/metricsql
|
||||
github.com/VictoriaMetrics/metricsql/binaryop
|
||||
|
||||
Reference in New Issue
Block a user