mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-06 06:07:11 +02:00
Apply review feedback
Make the order of aggregate parts the same as before. Make error message match. Fix up benchmark for changes elsewhere. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
e4789cf89f
commit
75b72c2e42
@ -665,7 +665,7 @@ func BenchmarkParser(b *testing.B) {
|
||||
expr, _ := parser.ParseExpr(c)
|
||||
start, end := time.Now().Add(-time.Hour), time.Now()
|
||||
for i := 0; i < b.N; i++ {
|
||||
promql.PreprocessExpr(expr, start, end)
|
||||
promql.PreprocessExpr(expr, start, end, 0)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -394,13 +394,13 @@ func ChildrenIter(node Node) func(func(Node) bool) {
|
||||
}
|
||||
}
|
||||
case *AggregateExpr:
|
||||
if n.Param != nil {
|
||||
if !yield(n.Param) {
|
||||
if n.Expr != nil {
|
||||
if !yield(n.Expr) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if n.Expr != nil {
|
||||
yield(n.Expr)
|
||||
if n.Param != nil {
|
||||
yield(n.Param)
|
||||
}
|
||||
case *BinaryExpr:
|
||||
if !yield(n.LHS) {
|
||||
@ -426,7 +426,7 @@ func ChildrenIter(node Node) func(func(Node) bool) {
|
||||
case *NumberLiteral, *StringLiteral, *VectorSelector:
|
||||
// nothing to do
|
||||
default:
|
||||
panic(fmt.Errorf("promql.Children: unhandled node type %T", node))
|
||||
panic(fmt.Errorf("promql.ChildrenIter: unhandled node type %T", node))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user