Expand description
Aggregation grouping clause parsing for PromQL.
This module handles parsing the grouping clauses used with aggregation operators:
by (label1, label2)- Group by specific labels, dropping all otherswithout (label1, label2)- Drop specific labels, keeping all others
§Supported Aggregation Operators
These operators support grouping clauses:
sum, avg, count, min, max, group, stddev, stdvar,
topk, bottomk, count_values, quantile, limitk, limit_ratio
§Examples
use rusty_promql_parser::parser::aggregation::{grouping, GroupingAction};
let (rest, g) = grouping("by (job, instance)").unwrap();
assert!(rest.is_empty());
assert_eq!(g.action, GroupingAction::By);
assert_eq!(g.labels, vec!["job", "instance"]);
let (rest, g) = grouping("without (instance)").unwrap();
assert!(rest.is_empty());
assert_eq!(g.action, GroupingAction::Without);Structs§
- Grouping
- Grouping clause for aggregation expressions.
Enums§
- Grouping
Action - The action for aggregation grouping:
byorwithout.
Functions§
- grouping
- Parse a grouping clause:
by (label1, label2)orwithout (label1, label2)