2021-08-29 13:16:25 +00:00
|
|
|
# Numeric literals
|
|
|
|
|
|
|
|
0.123e3
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(NumberLiteral)
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Double-quoted string literal
|
|
|
|
|
|
|
|
"test string"
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(StringLiteral)
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Single-quoted string literal
|
|
|
|
|
|
|
|
'test string'
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(StringLiteral)
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Backtick-quoted string literal
|
|
|
|
|
|
|
|
`test string`
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(StringLiteral)
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Backtick-quoted multi-line string literal
|
|
|
|
|
|
|
|
`test
|
|
|
|
|
|
|
|
string`
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(StringLiteral)
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Addition
|
|
|
|
|
|
|
|
1 + 2
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(BinaryExpr(NumberLiteral, Add, NumberLiteral))
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Complex expression
|
|
|
|
|
|
|
|
sum by(job, mode) (rate(node_cpu_seconds_total[1m])) / on(job) group_left sum by(job)(rate(node_cpu_seconds_total[1m]))
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
|
|
|
PromQL(
|
|
|
|
BinaryExpr(
|
|
|
|
AggregateExpr(
|
|
|
|
AggregateOp(Sum),
|
|
|
|
AggregateModifier(
|
|
|
|
By,
|
|
|
|
GroupingLabels(
|
2022-09-29 20:26:46 +00:00
|
|
|
LabelName,
|
|
|
|
LabelName
|
2021-08-29 13:16:25 +00:00
|
|
|
)
|
|
|
|
),
|
|
|
|
FunctionCallBody(
|
|
|
|
FunctionCall(
|
|
|
|
FunctionIdentifier(Rate),
|
|
|
|
FunctionCallBody(
|
|
|
|
MatrixSelector(
|
|
|
|
VectorSelector(
|
|
|
|
Identifier
|
2022-09-29 20:26:46 +00:00
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
Duration
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
Div,
|
2022-09-29 20:26:46 +00:00
|
|
|
MatchingModifierClause(
|
2021-08-29 13:16:25 +00:00
|
|
|
On,
|
|
|
|
GroupingLabels(
|
2022-09-29 20:26:46 +00:00
|
|
|
LabelName
|
2021-08-29 13:16:25 +00:00
|
|
|
)
|
2022-09-29 20:26:46 +00:00
|
|
|
GroupLeft
|
2021-08-29 13:16:25 +00:00
|
|
|
),
|
|
|
|
AggregateExpr(
|
|
|
|
AggregateOp(Sum),
|
|
|
|
AggregateModifier(
|
|
|
|
By,
|
|
|
|
GroupingLabels(
|
2022-09-29 20:26:46 +00:00
|
|
|
LabelName
|
2021-08-29 13:16:25 +00:00
|
|
|
)
|
|
|
|
),
|
|
|
|
FunctionCallBody(
|
|
|
|
FunctionCall(
|
|
|
|
FunctionIdentifier(Rate),
|
|
|
|
FunctionCallBody(
|
|
|
|
MatrixSelector(
|
|
|
|
VectorSelector(
|
|
|
|
Identifier
|
2022-09-29 20:26:46 +00:00
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
Duration
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Case insensitivity for aggregations and binop modifiers.
|
|
|
|
|
|
|
|
SuM BY(testlabel1) (testmetric1) / IGNOring(testlabel2) AVG withOUT(testlabel3) (testmetric2)
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
|
|
|
PromQL(
|
|
|
|
BinaryExpr(
|
|
|
|
AggregateExpr(
|
|
|
|
AggregateOp(Sum),
|
|
|
|
AggregateModifier(
|
|
|
|
By,
|
|
|
|
GroupingLabels(
|
2022-09-29 20:26:46 +00:00
|
|
|
LabelName
|
2021-08-29 13:16:25 +00:00
|
|
|
)
|
|
|
|
),
|
|
|
|
FunctionCallBody(
|
|
|
|
VectorSelector(
|
2022-09-29 20:26:46 +00:00
|
|
|
Identifier
|
2021-08-29 13:16:25 +00:00
|
|
|
)
|
|
|
|
)
|
2022-09-29 20:26:46 +00:00
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
Div,
|
2022-09-29 20:26:46 +00:00
|
|
|
MatchingModifierClause(
|
2021-08-29 13:16:25 +00:00
|
|
|
Ignoring,
|
|
|
|
GroupingLabels(
|
2022-09-29 20:26:46 +00:00
|
|
|
LabelName
|
2021-08-29 13:16:25 +00:00
|
|
|
)
|
2022-09-29 20:26:46 +00:00
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
AggregateExpr(
|
|
|
|
AggregateOp(Avg),
|
|
|
|
AggregateModifier(
|
|
|
|
Without,
|
|
|
|
GroupingLabels(
|
2022-09-29 20:26:46 +00:00
|
|
|
LabelName
|
2021-08-29 13:16:25 +00:00
|
|
|
)
|
|
|
|
),
|
|
|
|
FunctionCallBody(
|
|
|
|
VectorSelector(
|
|
|
|
Identifier
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Case insensitivity for set operators
|
|
|
|
|
|
|
|
metric1 and metric2 AND metric3 unless metric4 UNLESS metric5 or metric6 OR metric7
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
|
|
|
PromQL(
|
2022-09-29 20:26:46 +00:00
|
|
|
BinaryExpr(
|
2021-08-29 13:16:25 +00:00
|
|
|
BinaryExpr(
|
2022-09-29 20:26:46 +00:00
|
|
|
BinaryExpr(
|
2021-08-29 13:16:25 +00:00
|
|
|
BinaryExpr(
|
2022-09-29 20:26:46 +00:00
|
|
|
BinaryExpr(
|
2021-08-29 13:16:25 +00:00
|
|
|
BinaryExpr(
|
2022-09-29 20:26:46 +00:00
|
|
|
VectorSelector(Identifier),
|
|
|
|
And,
|
|
|
|
VectorSelector(Identifier)
|
|
|
|
),
|
|
|
|
And,
|
|
|
|
VectorSelector(Identifier)
|
2021-08-29 13:16:25 +00:00
|
|
|
),
|
2022-09-29 20:26:46 +00:00
|
|
|
Unless,
|
|
|
|
VectorSelector(Identifier)
|
|
|
|
),
|
|
|
|
Unless,
|
|
|
|
VectorSelector(Identifier)
|
2021-08-29 13:16:25 +00:00
|
|
|
),
|
|
|
|
Or,
|
2022-09-29 20:26:46 +00:00
|
|
|
VectorSelector(Identifier)
|
|
|
|
),
|
|
|
|
Or,
|
|
|
|
VectorSelector(Identifier)
|
2021-08-29 13:16:25 +00:00
|
|
|
)
|
|
|
|
)
|
2022-09-29 20:26:46 +00:00
|
|
|
|
2021-08-29 13:16:25 +00:00
|
|
|
# Duration units
|
|
|
|
|
|
|
|
foo[1y2w3d4h5m6s7ms]
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(MatrixSelector(VectorSelector(Identifier),Duration))
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Incorrectly ordered duration units
|
|
|
|
|
|
|
|
foo[1m2h]
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(SubqueryExpr(VectorSelector(Identifier),Duration,⚠,Duration))
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Using a function name as a metric name
|
|
|
|
|
|
|
|
rate
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(VectorSelector(Identifier))
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Match operators
|
|
|
|
|
|
|
|
metric_name{a="1",b!="2",c=~"3",d!~"4"}
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
|
|
|
PromQL(
|
|
|
|
VectorSelector(
|
2022-09-29 20:26:46 +00:00
|
|
|
Identifier,
|
2021-08-29 13:16:25 +00:00
|
|
|
LabelMatchers(
|
2022-09-29 20:26:46 +00:00
|
|
|
LabelMatcher(
|
|
|
|
LabelName,
|
|
|
|
MatchOp(EqlSingle),
|
|
|
|
StringLiteral
|
|
|
|
),
|
|
|
|
LabelMatcher(
|
|
|
|
LabelName,
|
|
|
|
MatchOp(Neq),
|
|
|
|
StringLiteral
|
2021-08-29 13:16:25 +00:00
|
|
|
),
|
2022-09-29 20:26:46 +00:00
|
|
|
LabelMatcher(
|
|
|
|
LabelName,
|
|
|
|
MatchOp(EqlRegex),
|
|
|
|
StringLiteral
|
|
|
|
),
|
|
|
|
LabelMatcher(
|
|
|
|
LabelName,
|
|
|
|
MatchOp(NeqRegex),
|
|
|
|
StringLiteral
|
|
|
|
)
|
2021-08-29 13:16:25 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Binary expression with bool modifier
|
|
|
|
|
|
|
|
metric_name > bool 1
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
|
|
|
PromQL(
|
|
|
|
BinaryExpr(
|
|
|
|
VectorSelector(
|
2022-09-29 20:26:46 +00:00
|
|
|
Identifier
|
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
Gtr,
|
2022-09-29 20:26:46 +00:00
|
|
|
BoolModifier(Bool),
|
|
|
|
NumberLiteral
|
2021-08-29 13:16:25 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Binary expression with group_x() labels.
|
|
|
|
|
|
|
|
metric1 + on(foo) group_left(bar, baz) metric2
|
|
|
|
|
|
|
|
==>
|
|
|
|
|
|
|
|
PromQL(
|
|
|
|
BinaryExpr(
|
|
|
|
VectorSelector(
|
2022-09-29 20:26:46 +00:00
|
|
|
Identifier
|
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
Add,
|
2022-09-29 20:26:46 +00:00
|
|
|
MatchingModifierClause(
|
2021-08-29 13:16:25 +00:00
|
|
|
On,
|
|
|
|
GroupingLabels(
|
2022-09-29 20:26:46 +00:00
|
|
|
LabelName
|
2021-08-29 13:16:25 +00:00
|
|
|
)
|
2022-09-29 20:26:46 +00:00
|
|
|
GroupLeft,
|
|
|
|
GroupingLabels(
|
|
|
|
LabelName,
|
|
|
|
LabelName
|
2021-08-29 13:16:25 +00:00
|
|
|
)
|
2022-09-29 20:26:46 +00:00
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
VectorSelector(
|
|
|
|
Identifier
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Function last_over_time
|
|
|
|
|
|
|
|
last_over_time(data[1m])
|
|
|
|
|
|
|
|
==>
|
|
|
|
PromQL(
|
|
|
|
FunctionCall(
|
|
|
|
FunctionIdentifier(LastOverTime),
|
|
|
|
FunctionCallBody(
|
|
|
|
MatrixSelector(
|
|
|
|
VectorSelector(
|
|
|
|
Identifier
|
2022-09-29 20:26:46 +00:00
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
Duration
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Function sgn
|
|
|
|
|
|
|
|
sgn(data)
|
|
|
|
|
|
|
|
==>
|
|
|
|
PromQL(
|
|
|
|
FunctionCall(
|
|
|
|
FunctionIdentifier(Sgn),
|
|
|
|
FunctionCallBody(
|
|
|
|
VectorSelector(
|
|
|
|
Identifier
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Function clamp
|
|
|
|
|
|
|
|
clamp(data,0,1)
|
|
|
|
|
|
|
|
==>
|
|
|
|
PromQL(
|
|
|
|
FunctionCall(
|
|
|
|
FunctionIdentifier(Clamp),
|
|
|
|
FunctionCallBody(
|
2022-09-29 20:26:46 +00:00
|
|
|
VectorSelector(Identifier),
|
|
|
|
NumberLiteral,
|
|
|
|
NumberLiteral
|
2021-08-29 13:16:25 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Metric start
|
|
|
|
|
|
|
|
start
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(VectorSelector(Identifier))
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Metric end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(VectorSelector(Identifier))
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Simple At start
|
|
|
|
|
|
|
|
foo @ start()
|
|
|
|
|
|
|
|
==>
|
|
|
|
PromQL(
|
|
|
|
StepInvariantExpr(
|
|
|
|
VectorSelector(
|
|
|
|
Identifier
|
2022-09-29 20:26:46 +00:00
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
At,
|
|
|
|
AtModifierPreprocessors(Start),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Simple At end
|
|
|
|
|
|
|
|
foo @ end()
|
|
|
|
|
|
|
|
==>
|
|
|
|
PromQL(
|
|
|
|
StepInvariantExpr(
|
|
|
|
VectorSelector(
|
|
|
|
Identifier
|
2022-09-29 20:26:46 +00:00
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
At,
|
|
|
|
AtModifierPreprocessors(End),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Simple At number
|
|
|
|
|
|
|
|
foo @ 1234
|
|
|
|
|
|
|
|
==>
|
|
|
|
PromQL(
|
|
|
|
StepInvariantExpr(
|
|
|
|
VectorSelector(
|
|
|
|
Identifier
|
2022-09-29 20:26:46 +00:00
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
At,
|
|
|
|
NumberLiteral
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# At Modifier with space between bracket
|
|
|
|
|
|
|
|
foo @ start( )
|
|
|
|
|
|
|
|
==>
|
|
|
|
PromQL(
|
|
|
|
StepInvariantExpr(
|
|
|
|
VectorSelector(
|
|
|
|
Identifier
|
2022-09-29 20:26:46 +00:00
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
At,
|
|
|
|
AtModifierPreprocessors(Start),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Complex test with At modifier
|
|
|
|
|
|
|
|
rate(process_cpu_seconds_total[1m])
|
|
|
|
and
|
|
|
|
topk(7, rate(process_cpu_seconds_total[1h] @ 1234))
|
|
|
|
|
|
|
|
==>
|
|
|
|
PromQL(
|
|
|
|
BinaryExpr(
|
|
|
|
FunctionCall(
|
|
|
|
FunctionIdentifier(Rate),
|
|
|
|
FunctionCallBody(
|
|
|
|
MatrixSelector(
|
2022-09-29 20:26:46 +00:00
|
|
|
VectorSelector(Identifier),
|
2021-08-29 13:16:25 +00:00
|
|
|
Duration
|
|
|
|
)
|
|
|
|
)
|
2022-09-29 20:26:46 +00:00
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
And,
|
|
|
|
AggregateExpr(
|
|
|
|
AggregateOp(Topk),
|
|
|
|
FunctionCallBody(
|
2022-09-29 20:26:46 +00:00
|
|
|
NumberLiteral,
|
|
|
|
FunctionCall(
|
|
|
|
FunctionIdentifier(Rate),
|
|
|
|
FunctionCallBody(
|
|
|
|
StepInvariantExpr(
|
|
|
|
MatrixSelector(VectorSelector(Identifier), Duration),
|
|
|
|
At,
|
|
|
|
NumberLiteral
|
2021-08-29 13:16:25 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# At modifier with negative number
|
|
|
|
|
|
|
|
foo @ - 1234
|
|
|
|
|
|
|
|
==>
|
|
|
|
PromQL(
|
|
|
|
StepInvariantExpr(
|
|
|
|
VectorSelector(
|
|
|
|
Identifier
|
2022-09-29 20:26:46 +00:00
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
At,
|
|
|
|
NumberLiteral
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# At modifier with explicit positive number
|
|
|
|
|
|
|
|
foo @ + 1234
|
|
|
|
|
|
|
|
==>
|
|
|
|
PromQL(
|
|
|
|
StepInvariantExpr(
|
|
|
|
VectorSelector(
|
|
|
|
Identifier
|
2022-09-29 20:26:46 +00:00
|
|
|
),
|
2021-08-29 13:16:25 +00:00
|
|
|
At,
|
|
|
|
NumberLiteral
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Metric prefixed by Inf
|
|
|
|
|
|
|
|
infra
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(VectorSelector(Identifier))
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Metric prefixed by Nan
|
|
|
|
|
|
|
|
nananere
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(VectorSelector(Identifier))
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Mixed-case NaN.
|
|
|
|
|
|
|
|
NaN
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(NumberLiteral)
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Lower-cased NaN.
|
|
|
|
|
|
|
|
nan
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(NumberLiteral)
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Inf.
|
|
|
|
|
|
|
|
Inf
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(NumberLiteral)
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Negative Inf.
|
|
|
|
|
|
|
|
-Inf
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(NumberLiteral)
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Positive Inf.
|
|
|
|
|
|
|
|
+Inf
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(NumberLiteral)
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Lower-cased Inf.
|
|
|
|
|
|
|
|
inf
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(NumberLiteral)
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Upper-cased Inf.
|
|
|
|
|
|
|
|
INF
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(NumberLiteral)
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Negative number literal.
|
|
|
|
|
|
|
|
-42
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(NumberLiteral)
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Explicitly positive number literal.
|
|
|
|
|
|
|
|
+42
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(NumberLiteral)
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Trying to illegally use NaN as a metric name.
|
|
|
|
|
|
|
|
NaN{foo="bar"}
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(BinaryExpr(NumberLiteral,⚠,VectorSelector(LabelMatchers(LabelMatcher(LabelName,MatchOp(EqlSingle),StringLiteral)))))
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Trying to illegally use Inf as a metric name.
|
|
|
|
|
|
|
|
Inf{foo="bar"}
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(BinaryExpr(NumberLiteral,⚠,VectorSelector(LabelMatchers(LabelMatcher(LabelName,MatchOp(EqlSingle),StringLiteral)))))
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Negative offset
|
|
|
|
|
|
|
|
foo offset -5d
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(OffsetExpr(VectorSelector(Identifier), Offset, Sub, Duration))
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Negative offset with space
|
|
|
|
|
|
|
|
foo offset - 5d
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(OffsetExpr(VectorSelector(Identifier), Offset, Sub, Duration))
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Positive offset
|
|
|
|
|
|
|
|
foo offset 5d
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(OffsetExpr(VectorSelector(Identifier), Offset, Duration))
|
2021-08-29 13:16:25 +00:00
|
|
|
|
|
|
|
# Parsing only metric names with alternative @top { "top": "MetricName" }
|
|
|
|
|
|
|
|
sum:my_metric_name:rate5m
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
MetricName(Identifier)
|
2021-09-26 19:45:25 +00:00
|
|
|
|
|
|
|
# Testing Atan2 inherited precedence level
|
|
|
|
|
|
|
|
1 + foo atan2 bar
|
|
|
|
|
|
|
|
==>
|
2022-09-29 20:26:46 +00:00
|
|
|
PromQL(BinaryExpr(NumberLiteral,Add,BinaryExpr(VectorSelector(Identifier),Atan2,VectorSelector(Identifier))))
|