Expand description
Abstract Syntax Tree (AST) types for PromQL expressions.
This module defines all the types that make up the parsed representation
of a PromQL query. The main type is Expr, which represents any valid
PromQL expression.
§Overview
PromQL expressions can be:
- Literals: Numbers (
Expr::Number) and strings (Expr::String) - Selectors: Instant vectors (
Expr::VectorSelector) and range vectors (Expr::MatrixSelector) - Operations: Binary (
Expr::Binary) and unary (Expr::Unary) expressions - Functions: Function calls (
Expr::Call) and aggregations (Expr::Aggregation) - Subqueries: Range queries over instant vectors (
Expr::Subquery)
§Display
All AST types implement std::fmt::Display to convert back to PromQL syntax:
use rusty_promql_parser::expr;
let (_, ast) = expr("sum(rate(http_requests[5m]))").unwrap();
println!("{}", ast); // Prints: sum(rate(http_requests[5m]))Structs§
- Aggregation
- Aggregation expression
- Binary
Expr - Binary expression
- Binary
Modifier - Modifier for binary operations
- Call
- Function call expression
- Group
Modifier - Group modifier for many-to-one/one-to-many matching
- Subquery
Expr - Subquery expression
- Unary
Expr - Unary expression
- Vector
Matching - Vector matching specification for binary operations
Enums§
- Binary
Op - Binary operators
- Expr
- Root expression type for PromQL AST
- Group
Side - Group modifier side
- UnaryOp
- Unary operators
- Vector
Matching Op - Vector matching for binary operations