mirror of
https://github.com/prometheus/prometheus.git
synced 2026-05-28 04:02:21 -04:00
Merge pull request #16702 from bboreham/simpler-detect
[Refactor] PromQL: Simplify detectHistogramStatsDecoding
This commit is contained in:
commit
f69c83f5f1
1 changed files with 2 additions and 8 deletions
|
|
@ -3842,19 +3842,13 @@ func setOffsetForAtModifier(evalTime int64, expr parser.Expr) {
|
|||
// required for correctness.
|
||||
func detectHistogramStatsDecoding(expr parser.Expr) {
|
||||
parser.Inspect(expr, func(node parser.Node, path []parser.Node) error {
|
||||
if n, ok := node.(*parser.BinaryExpr); ok {
|
||||
detectHistogramStatsDecoding(n.LHS)
|
||||
detectHistogramStatsDecoding(n.RHS)
|
||||
return errors.New("stop")
|
||||
}
|
||||
|
||||
n, ok := (node).(*parser.VectorSelector)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, p := range path {
|
||||
call, ok := p.(*parser.Call)
|
||||
for i := len(path) - 1; i > 0; i-- { // Walk backwards up the path.
|
||||
call, ok := path[i].(*parser.Call)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue