Documentation ¶
Index ¶
- func HasOuterAggregation(node *parser.PromQLNode) (aggs []*promParser.AggregateExpr)
- func HasOuterBinaryExpr(node *parser.PromQLNode) *promParser.BinaryExpr
- func HasOuterRate(node *parser.PromQLNode) (calls []*promParser.Call)
- func HasOuterSum(node *parser.PromQLNode) (calls []*promParser.AggregateExpr)
- func HasVectorSelector(node *parser.PromQLNode) (vs []*promParser.VectorSelector)
- func RemoveConditions(source string) promParser.Node
- type Node
- type PromQLFragment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasOuterAggregation ¶
func HasOuterAggregation(node *parser.PromQLNode) (aggs []*promParser.AggregateExpr)
func HasOuterBinaryExpr ¶ added in v0.8.0
func HasOuterBinaryExpr(node *parser.PromQLNode) *promParser.BinaryExpr
func HasOuterRate ¶ added in v0.28.0
func HasOuterRate(node *parser.PromQLNode) (calls []*promParser.Call)
func HasOuterSum ¶ added in v0.41.0
func HasOuterSum(node *parser.PromQLNode) (calls []*promParser.AggregateExpr)
func HasVectorSelector ¶ added in v0.4.1
func HasVectorSelector(node *parser.PromQLNode) (vs []*promParser.VectorSelector)
func RemoveConditions ¶ added in v0.10.1
func RemoveConditions(source string) promParser.Node
RemoveConditions takes a *valid* PromQL expression and removes any condition from it.
Types ¶
type Node ¶ added in v0.55.0
Node is used to turn the parsed PromQL query expression into a tree. This allows us to walk the tree up & down and look for either parents or children of specific type. Which is useful if you, for example, want to check if all vector selectors are wrapped inside function calls etc.
func Tree ¶ added in v0.55.0
Tree takes a parsed PromQL node and turns it into a Node instance with parent and children populated.
func WalkDown ¶ added in v0.55.0
WalkDown works just like findParents but it walks the tree down, visiting all children. It also starts by checking the node passed to it before walking down the tree.
func WalkUp ¶ added in v0.55.0
WalkUp allows to iterate a promQLNode node looking for parents of specific type. Prometheus parser returns interfaces which makes it more difficult to figure out what kind of node we're dealing with, hence this helper takes a type parameter it tries to cast. It starts by checking the node passed to it and then walks up by visiting all parent nodes.
type PromQLFragment ¶ added in v0.16.1
type PromQLFragment struct { Fragment *parser.PromQLNode BinExpr *promParser.BinaryExpr }
func HasOuterAbsent ¶ added in v0.4.1
func HasOuterAbsent(node *parser.PromQLNode) (calls []PromQLFragment)