mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
vendor: return back the working github.com/VictoriaMetrics/metricsql release after 4a338d32ce
This commit is contained in:
parent
dc88916fea
commit
5ea79f65c3
8 changed files with 195 additions and 803 deletions
2
go.mod
2
go.mod
|
@ -12,7 +12,7 @@ require (
|
|||
// like https://github.com/valyala/fasthttp/commit/996610f021ff45fdc98c2ce7884d5fa4e7f9199b
|
||||
github.com/VictoriaMetrics/fasthttp v1.2.0
|
||||
github.com/VictoriaMetrics/metrics v1.24.0
|
||||
github.com/VictoriaMetrics/metricsql v0.64.0
|
||||
github.com/VictoriaMetrics/metricsql v0.56.2
|
||||
github.com/aws/aws-sdk-go-v2 v1.21.0
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.38
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.82
|
||||
|
|
7
go.sum
7
go.sum
|
@ -68,10 +68,11 @@ github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bw
|
|||
github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o=
|
||||
github.com/VictoriaMetrics/fasthttp v1.2.0 h1:nd9Wng4DlNtaI27WlYh5mGXCJOmee/2c2blTJwfyU9I=
|
||||
github.com/VictoriaMetrics/fasthttp v1.2.0/go.mod h1:zv5YSmasAoSyv8sBVexfArzFDIGGTN4TfCKAtAw7IfE=
|
||||
github.com/VictoriaMetrics/metrics v1.18.1/go.mod h1:ArjwVz7WpgpegX/JpB0zpNF2h2232kErkEnzH1sxMmA=
|
||||
github.com/VictoriaMetrics/metrics v1.24.0 h1:ILavebReOjYctAGY5QU2F9X0MYvkcrG3aEn2RKa1Zkw=
|
||||
github.com/VictoriaMetrics/metrics v1.24.0/go.mod h1:eFT25kvsTidQFHb6U0oa0rTrDRdz4xTYjpL8+UPohys=
|
||||
github.com/VictoriaMetrics/metricsql v0.64.0 h1:uty6AXQFY3OpQ+eopo1jDjCcTctuqkqYLnRbQVhukW8=
|
||||
github.com/VictoriaMetrics/metricsql v0.64.0/go.mod h1:k4UaP/+CjuZslIjd+kCigNG9TQmUqh5v0TP/nMEy90I=
|
||||
github.com/VictoriaMetrics/metricsql v0.56.2 h1:quBAbYOlWMhmdgzFSCr1yjtVcdZYZrVQJ7nR9zor7ZM=
|
||||
github.com/VictoriaMetrics/metricsql v0.56.2/go.mod h1:6pP1ZeLVJHqJrHlF6Ij3gmpQIznSsgktEcZgsAWYel0=
|
||||
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=
|
||||
|
@ -633,8 +634,6 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
|
|
19
vendor/github.com/VictoriaMetrics/metricsql/lexer.go
generated
vendored
19
vendor/github.com/VictoriaMetrics/metricsql/lexer.go
generated
vendored
|
@ -37,11 +37,6 @@ func (lex *lexer) Init(s string) {
|
|||
lex.sTail = s
|
||||
}
|
||||
|
||||
func (lex *lexer) PushBack(currToken, sHead string) {
|
||||
lex.Token = currToken
|
||||
lex.sTail = sHead + lex.sTail
|
||||
}
|
||||
|
||||
func (lex *lexer) Next() error {
|
||||
if lex.err != nil {
|
||||
return lex.err
|
||||
|
@ -233,7 +228,7 @@ func scanPositiveNumber(s string) (string, error) {
|
|||
}
|
||||
return s[:i], nil
|
||||
}
|
||||
for i < len(s) && isDecimalCharOrUnderscore(s[i]) {
|
||||
for i < len(s) && isDecimalChar(s[i]) {
|
||||
i++
|
||||
}
|
||||
|
||||
|
@ -258,7 +253,7 @@ func scanPositiveNumber(s string) (string, error) {
|
|||
// Scan fractional part. It cannot be empty.
|
||||
i++
|
||||
j := i
|
||||
for j < len(s) && isDecimalCharOrUnderscore(s[j]) {
|
||||
for j < len(s) && isDecimalChar(s[j]) {
|
||||
j++
|
||||
}
|
||||
i = j
|
||||
|
@ -566,8 +561,10 @@ func DurationValue(s string, step int64) (int64, error) {
|
|||
func parseSingleDuration(s string, step int64) (float64, error) {
|
||||
s = strings.ToLower(s)
|
||||
numPart := s[:len(s)-1]
|
||||
// Strip trailing m if the duration is in ms
|
||||
numPart = strings.TrimSuffix(numPart, "m")
|
||||
if strings.HasSuffix(numPart, "m") {
|
||||
// Duration in ms
|
||||
numPart = numPart[:len(numPart)-1]
|
||||
}
|
||||
f, err := strconv.ParseFloat(numPart, 64)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("cannot parse duration %q: %s", s, err)
|
||||
|
@ -673,10 +670,6 @@ func isDecimalChar(ch byte) bool {
|
|||
return ch >= '0' && ch <= '9'
|
||||
}
|
||||
|
||||
func isDecimalCharOrUnderscore(ch byte) bool {
|
||||
return isDecimalChar(ch) || ch == '_'
|
||||
}
|
||||
|
||||
func isHexChar(ch byte) bool {
|
||||
return isDecimalChar(ch) || ch >= 'a' && ch <= 'f' || ch >= 'A' && ch <= 'F'
|
||||
}
|
||||
|
|
24
vendor/github.com/VictoriaMetrics/metricsql/optimizer.go
generated
vendored
24
vendor/github.com/VictoriaMetrics/metricsql/optimizer.go
generated
vendored
|
@ -78,7 +78,7 @@ func optimizeInplace(e Expr) {
|
|||
func getCommonLabelFilters(e Expr) []LabelFilter {
|
||||
switch t := e.(type) {
|
||||
case *MetricExpr:
|
||||
return getCommonLabelFiltersWithoutMetricName(t.LabelFilterss)
|
||||
return getLabelFiltersWithoutMetricName(t.LabelFilters)
|
||||
case *RollupExpr:
|
||||
return getCommonLabelFilters(t.Expr)
|
||||
case *FuncExpr:
|
||||
|
@ -180,21 +180,6 @@ func TrimFiltersByGroupModifier(lfs []LabelFilter, be *BinaryOpExpr) []LabelFilt
|
|||
}
|
||||
}
|
||||
|
||||
func getCommonLabelFiltersWithoutMetricName(lfss [][]LabelFilter) []LabelFilter {
|
||||
if len(lfss) == 0 {
|
||||
return nil
|
||||
}
|
||||
lfsA := getLabelFiltersWithoutMetricName(lfss[0])
|
||||
for _, lfs := range lfss[1:] {
|
||||
if len(lfsA) == 0 {
|
||||
return nil
|
||||
}
|
||||
lfsB := getLabelFiltersWithoutMetricName(lfs)
|
||||
lfsA = intersectLabelFilters(lfsA, lfsB)
|
||||
}
|
||||
return lfsA
|
||||
}
|
||||
|
||||
func getLabelFiltersWithoutMetricName(lfs []LabelFilter) []LabelFilter {
|
||||
lfsNew := make([]LabelFilter, 0, len(lfs))
|
||||
for _, lf := range lfs {
|
||||
|
@ -228,11 +213,8 @@ func pushdownBinaryOpFiltersInplace(e Expr, lfs []LabelFilter) {
|
|||
}
|
||||
switch t := e.(type) {
|
||||
case *MetricExpr:
|
||||
for i, lfsLocal := range t.LabelFilterss {
|
||||
lfsLocal = unionLabelFilters(lfsLocal, lfs)
|
||||
sortLabelFilters(lfsLocal)
|
||||
t.LabelFilterss[i] = lfsLocal
|
||||
}
|
||||
t.LabelFilters = unionLabelFilters(t.LabelFilters, lfs)
|
||||
sortLabelFilters(t.LabelFilters)
|
||||
case *RollupExpr:
|
||||
pushdownBinaryOpFiltersInplace(t.Expr, lfs)
|
||||
case *FuncExpr:
|
||||
|
|
742
vendor/github.com/VictoriaMetrics/metricsql/parser.go
generated
vendored
742
vendor/github.com/VictoriaMetrics/metricsql/parser.go
generated
vendored
File diff suppressed because it is too large
Load diff
201
vendor/github.com/VictoriaMetrics/metricsql/prettifier.go
generated
vendored
201
vendor/github.com/VictoriaMetrics/metricsql/prettifier.go
generated
vendored
|
@ -1,201 +0,0 @@
|
|||
package metricsql
|
||||
|
||||
// Prettify returns prettified representation of MetricsQL query q.
|
||||
func Prettify(q string) (string, error) {
|
||||
e, err := Parse(q)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
b := appendPrettifiedExpr(nil, e, 0, false)
|
||||
return string(b), nil
|
||||
}
|
||||
|
||||
// maxPrettifiedLineLen is the maximum length of a single line returned by Prettify().
|
||||
//
|
||||
// Actual lines may exceed the maximum length in some cases.
|
||||
const maxPrettifiedLineLen = 80
|
||||
|
||||
func appendPrettifiedExpr(dst []byte, e Expr, indent int, needParens bool) []byte {
|
||||
dstLen := len(dst)
|
||||
|
||||
// Try appending e to dst and check whether its length exceeds the maximum allowed line length.
|
||||
dst = appendIndent(dst, indent)
|
||||
if needParens {
|
||||
dst = append(dst, '(')
|
||||
}
|
||||
dst = e.AppendString(dst)
|
||||
if needParens {
|
||||
dst = append(dst, ')')
|
||||
}
|
||||
if len(dst)-dstLen <= maxPrettifiedLineLen {
|
||||
// There is no need in splitting the e string representation, since its' length doesn't exceed.
|
||||
return dst
|
||||
}
|
||||
|
||||
// The e string representation exceeds maxPrettifiedLineLen. Split it into multiple lines
|
||||
dst = dst[:dstLen]
|
||||
if needParens {
|
||||
dst = appendIndent(dst, indent)
|
||||
dst = append(dst, "(\n"...)
|
||||
indent++
|
||||
}
|
||||
switch t := e.(type) {
|
||||
case *BinaryOpExpr:
|
||||
// Split:
|
||||
//
|
||||
// a op b
|
||||
//
|
||||
// into:
|
||||
//
|
||||
// foo
|
||||
// op
|
||||
// bar
|
||||
if t.KeepMetricNames {
|
||||
dst = appendIndent(dst, indent)
|
||||
dst = append(dst, "(\n"...)
|
||||
indent++
|
||||
}
|
||||
dst = appendPrettifiedExpr(dst, t.Left, indent, t.needLeftParens())
|
||||
dst = append(dst, '\n')
|
||||
dst = appendIndent(dst, indent+1)
|
||||
dst = t.appendModifiers(dst)
|
||||
dst = append(dst, '\n')
|
||||
dst = appendPrettifiedExpr(dst, t.Right, indent, t.needRightParens())
|
||||
if t.KeepMetricNames {
|
||||
indent--
|
||||
dst = append(dst, '\n')
|
||||
dst = appendIndent(dst, indent)
|
||||
dst = append(dst, ") keep_metric_names"...)
|
||||
}
|
||||
case *RollupExpr:
|
||||
// Split:
|
||||
//
|
||||
// q[d:s] offset off @ x
|
||||
//
|
||||
// into:
|
||||
//
|
||||
// (
|
||||
// q
|
||||
// )[d:s] offset off @ x
|
||||
dst = appendPrettifiedExpr(dst, t.Expr, indent, t.needParens())
|
||||
dst = t.appendModifiers(dst)
|
||||
case *AggrFuncExpr:
|
||||
// Split:
|
||||
//
|
||||
// aggr_func(arg1, ..., argN) modifiers
|
||||
//
|
||||
// into:
|
||||
//
|
||||
// aggr_func(
|
||||
// arg1,
|
||||
// ...
|
||||
// argN
|
||||
// ) modifiers
|
||||
dst = appendIndent(dst, indent)
|
||||
dst = appendEscapedIdent(dst, t.Name)
|
||||
dst = appendPrettifiedFuncArgs(dst, indent, t.Args)
|
||||
dst = t.appendModifiers(dst)
|
||||
case *FuncExpr:
|
||||
// Split:
|
||||
//
|
||||
// func(arg1, ..., argN) modifiers
|
||||
//
|
||||
// into:
|
||||
//
|
||||
// func(
|
||||
// arg1,
|
||||
// ...
|
||||
// argN
|
||||
// ) modifiers
|
||||
dst = appendIndent(dst, indent)
|
||||
dst = appendEscapedIdent(dst, t.Name)
|
||||
dst = appendPrettifiedFuncArgs(dst, indent, t.Args)
|
||||
dst = t.appendModifiers(dst)
|
||||
case *MetricExpr:
|
||||
// Split:
|
||||
//
|
||||
// metric{filters1 or ... or filtersN}
|
||||
//
|
||||
// into:
|
||||
//
|
||||
// metric{
|
||||
// filters1
|
||||
// or
|
||||
// ...
|
||||
// or
|
||||
// filtersN
|
||||
// }
|
||||
offset := 0
|
||||
metricName := t.getMetricName()
|
||||
if metricName != "" {
|
||||
offset = 1
|
||||
}
|
||||
dst = appendIndent(dst, indent)
|
||||
dst = appendEscapedIdent(dst, metricName)
|
||||
dst = append(dst, "{\n"...)
|
||||
lfss := t.LabelFilterss
|
||||
for i, lfs := range lfss {
|
||||
dst = appendPrettifiedLabelFilters(dst, indent+1, lfs[offset:])
|
||||
dst = append(dst, '\n')
|
||||
if i+1 < len(lfss) {
|
||||
dst = appendIndent(dst, indent+2)
|
||||
dst = append(dst, "or\n"...)
|
||||
}
|
||||
}
|
||||
dst = appendIndent(dst, indent)
|
||||
dst = append(dst, '}')
|
||||
default:
|
||||
// marshal other expressions as is
|
||||
dst = t.AppendString(dst)
|
||||
}
|
||||
if needParens {
|
||||
indent--
|
||||
dst = append(dst, '\n')
|
||||
dst = appendIndent(dst, indent)
|
||||
dst = append(dst, ')')
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
func appendPrettifiedFuncArgs(dst []byte, indent int, args []Expr) []byte {
|
||||
dst = append(dst, "(\n"...)
|
||||
for i, arg := range args {
|
||||
dst = appendPrettifiedExpr(dst, arg, indent+1, false)
|
||||
if i+1 < len(args) {
|
||||
dst = append(dst, ',')
|
||||
}
|
||||
dst = append(dst, '\n')
|
||||
}
|
||||
dst = appendIndent(dst, indent)
|
||||
dst = append(dst, ')')
|
||||
return dst
|
||||
}
|
||||
|
||||
func appendPrettifiedLabelFilters(dst []byte, indent int, lfs []LabelFilter) []byte {
|
||||
dstLen := len(dst)
|
||||
|
||||
// Try marshaling lfs into a single line
|
||||
dst = appendIndent(dst, indent)
|
||||
dst = appendLabelFilters(dst, lfs)
|
||||
if len(dst)-dstLen <= maxPrettifiedLineLen {
|
||||
return dst
|
||||
}
|
||||
|
||||
// Too long line - split it into multiple lines
|
||||
dst = dst[:dstLen]
|
||||
for i := range lfs {
|
||||
dst = appendIndent(dst, indent)
|
||||
dst = lfs[i].AppendString(dst)
|
||||
if i+1 < len(lfs) {
|
||||
dst = append(dst, ",\n"...)
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
func appendIndent(dst []byte, indent int) []byte {
|
||||
for i := 0; i < indent; i++ {
|
||||
dst = append(dst, " "...)
|
||||
}
|
||||
return dst
|
||||
}
|
1
vendor/github.com/VictoriaMetrics/metricsql/rollup.go
generated
vendored
1
vendor/github.com/VictoriaMetrics/metricsql/rollup.go
generated
vendored
|
@ -64,7 +64,6 @@ var rollupFuncs = map[string]bool{
|
|||
"scrape_interval": true,
|
||||
"share_gt_over_time": true,
|
||||
"share_le_over_time": true,
|
||||
"share_eq_over_time": true,
|
||||
"stale_samples_over_time": true,
|
||||
"stddev_over_time": true,
|
||||
"stdvar_over_time": true,
|
||||
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
@ -99,7 +99,7 @@ github.com/VictoriaMetrics/fasthttp/stackless
|
|||
# github.com/VictoriaMetrics/metrics v1.24.0
|
||||
## explicit; go 1.20
|
||||
github.com/VictoriaMetrics/metrics
|
||||
# github.com/VictoriaMetrics/metricsql v0.64.0
|
||||
# github.com/VictoriaMetrics/metricsql v0.56.2
|
||||
## explicit; go 1.13
|
||||
github.com/VictoriaMetrics/metricsql
|
||||
github.com/VictoriaMetrics/metricsql/binaryop
|
||||
|
|
Loading…
Reference in a new issue