mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
progress
This commit is contained in:
parent
fe0923b468
commit
345a7abea2
|
@ -471,6 +471,10 @@ func lexStatements(l *Lexer) stateFn {
|
|||
skipSpaces(l)
|
||||
}
|
||||
l.bracketOpen = true
|
||||
if l.peek() == '^' {
|
||||
l.emit(POW)
|
||||
l.next()
|
||||
}
|
||||
return lexDuration
|
||||
case r == ']':
|
||||
if !l.bracketOpen {
|
||||
|
|
|
@ -29,124 +29,7 @@ func TestExprString(t *testing.T) {
|
|||
in, out string
|
||||
}{
|
||||
{
|
||||
in: `sum by() (task:errors:rate10s{job="s"})`,
|
||||
out: `sum(task:errors:rate10s{job="s"})`,
|
||||
},
|
||||
{
|
||||
in: `sum by(code) (task:errors:rate10s{job="s"})`,
|
||||
out: `sum by (code) (task:errors:rate10s{job="s"})`,
|
||||
},
|
||||
{
|
||||
in: `sum without() (task:errors:rate10s{job="s"})`,
|
||||
out: `sum without () (task:errors:rate10s{job="s"})`,
|
||||
},
|
||||
{
|
||||
in: `sum without(instance) (task:errors:rate10s{job="s"})`,
|
||||
out: `sum without (instance) (task:errors:rate10s{job="s"})`,
|
||||
},
|
||||
{
|
||||
in: `topk(5, task:errors:rate10s{job="s"})`,
|
||||
},
|
||||
{
|
||||
in: `count_values("value", task:errors:rate10s{job="s"})`,
|
||||
},
|
||||
{
|
||||
in: `a - on() c`,
|
||||
out: `a - on () c`,
|
||||
},
|
||||
{
|
||||
in: `a - on(b) c`,
|
||||
out: `a - on (b) c`,
|
||||
},
|
||||
{
|
||||
in: `a - on(b) group_left(x) c`,
|
||||
out: `a - on (b) group_left (x) c`,
|
||||
},
|
||||
{
|
||||
in: `a - on(b) group_left(x, y) c`,
|
||||
out: `a - on (b) group_left (x, y) c`,
|
||||
},
|
||||
{
|
||||
in: `a - on(b) group_left c`,
|
||||
out: `a - on (b) group_left () c`,
|
||||
},
|
||||
{
|
||||
in: `a - on(b) group_left() (c)`,
|
||||
out: `a - on (b) group_left () (c)`,
|
||||
},
|
||||
{
|
||||
in: `a - ignoring(b) c`,
|
||||
out: `a - ignoring (b) c`,
|
||||
},
|
||||
{
|
||||
in: `a - ignoring() c`,
|
||||
out: `a - c`,
|
||||
},
|
||||
{
|
||||
in: `up > bool 0`,
|
||||
},
|
||||
{
|
||||
in: `a offset 1m`,
|
||||
},
|
||||
{
|
||||
in: `a offset -7m`,
|
||||
},
|
||||
{
|
||||
in: `a{c="d"}[5m] offset 1m`,
|
||||
},
|
||||
{
|
||||
in: `a[5m] offset 1m`,
|
||||
},
|
||||
{
|
||||
in: `a[12m] offset -3m`,
|
||||
},
|
||||
{
|
||||
in: `a[1h:5m] offset 1m`,
|
||||
},
|
||||
{
|
||||
in: `{__name__="a"}`,
|
||||
},
|
||||
{
|
||||
in: `a{b!="c"}[1m]`,
|
||||
},
|
||||
{
|
||||
in: `a{b=~"c"}[1m]`,
|
||||
},
|
||||
{
|
||||
in: `a{b!~"c"}[1m]`,
|
||||
},
|
||||
{
|
||||
in: `a @ 10`,
|
||||
out: `a @ 10.000`,
|
||||
},
|
||||
{
|
||||
in: `a[1m] @ 10`,
|
||||
out: `a[1m] @ 10.000`,
|
||||
},
|
||||
{
|
||||
in: `a @ start()`,
|
||||
},
|
||||
{
|
||||
in: `a @ end()`,
|
||||
},
|
||||
{
|
||||
in: `a[1m] @ start()`,
|
||||
},
|
||||
{
|
||||
in: `a[1m] @ end()`,
|
||||
},
|
||||
{
|
||||
in: `{__name__="",a="x"}`,
|
||||
},
|
||||
{
|
||||
in: `{"a.b"="c"}`,
|
||||
},
|
||||
{
|
||||
in: `{"0"="1"}`,
|
||||
},
|
||||
{
|
||||
in: `{"_0"="1"}`,
|
||||
out: `{_0="1"}`,
|
||||
in: `a[^1m]`,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue