mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
Allow lower-case BY operator.
This commit is contained in:
parent
f21b5ad12b
commit
000f6a2e23
|
@ -38,7 +38,7 @@ U [smhdwy]
|
|||
\/\/[^\r\n]*\n { /* gobble up one-line comments */ }
|
||||
|
||||
permanent { return PERMANENT }
|
||||
BY { return GROUP_OP }
|
||||
BY|by { return GROUP_OP }
|
||||
AVG|SUM|MAX|MIN { yylval.str = yytext; return AGGR_OP }
|
||||
avg|sum|max|min { yylval.str = strings.ToUpper(yytext); return AGGR_OP }
|
||||
\<|>|AND|OR { yylval.str = yytext; return CMP_OP }
|
||||
|
|
|
@ -315,7 +315,7 @@ var yyrules []yyrule = []yyrule{{regexp.MustCompile("[^\\n]"), nil, []yystartcon
|
|||
return yyactionreturn{PERMANENT, yyRT_USER_RETURN}
|
||||
}
|
||||
return yyactionreturn{0, yyRT_FALLTHROUGH}
|
||||
}}, {regexp.MustCompile("BY"), nil, []yystartcondition{}, false, func() (yyar yyactionreturn) {
|
||||
}}, {regexp.MustCompile("BY|by"), nil, []yystartcondition{}, false, func() (yyar yyactionreturn) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
if r != "yyREJECT" {
|
||||
|
|
|
@ -219,8 +219,11 @@ var expressionTests = []struct {
|
|||
intervalRanges: 1,
|
||||
}, {
|
||||
// Lower-cased aggregation operators should work too.
|
||||
expr: "sum(http_requests) + min(http_requests) + max(http_requests) + avg(http_requests)",
|
||||
output: []string{"http_requests{} => 4950 @[%v]"},
|
||||
expr: "sum(http_requests) by (job) + min(http_requests) by (job) + max(http_requests) by (job) + avg(http_requests) by (job)",
|
||||
output: []string{
|
||||
"http_requests{job='app-server'} => 4550 @[%v]",
|
||||
"http_requests{job='api-server'} => 1750 @[%v]",
|
||||
},
|
||||
fullRanges: 0,
|
||||
intervalRanges: 8,
|
||||
}, {
|
||||
|
|
Loading…
Reference in a new issue