#[non_exhaustive]pub enum MetricExpr {
Series(Series),
Function {
name: FuncKind,
arg: Box<MetricExpr>,
params: Vec<FuncParam>,
},
Transform {
name: String,
arg: Box<MetricExpr>,
args: Vec<ParamValue>,
},
Combine {
name: String,
args: Vec<MetricExpr>,
},
Arith {
op: ArithOp,
lhs: Box<MetricExpr>,
rhs: Box<MetricExpr>,
},
Change {
kind: ChangeKind,
inner_agg: TimeAgg,
shift: Window,
arg: Box<MetricExpr>,
},
Scalar(Scalar),
}Expand description
The recursive metric expression — the tree a visualization renders.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Series(Series)
A scoped metric: space_agg:metric.name{filter} by {tags}.modifiers.
Function
An evaluation function: anomalies / outliers / forecast.
Fields
arg: Box<MetricExpr>The inner expression the function evaluates.
Transform
A transform such as rollup / clamp_min / median_N / abs /
moving_rollup.
Fields
arg: Box<MetricExpr>The inner expression being transformed.
args: Vec<ParamValue>Arguments to the transform. Most are numeric (e.g. rollup(60)), but
some carry strings — e.g. moving_rollup(expr, 60, 'avg').
Combine
A spatial combiner over several sub-expressions, e.g.
max(avg:a{*}, avg:b{*}). name is the aggregator token
(max/min/sum/avg/count).
Fields
args: Vec<MetricExpr>The combined sub-expressions (two or more in practice).
Arith
Arithmetic: a + b, a / b * 100, etc.
Change
change() / pct_change() over a window shift.
Fields
kind: ChangeKindWhether this is an absolute or percentage change.
arg: Box<MetricExpr>The inner expression.
Scalar(Scalar)
A literal scalar operand (for arithmetic).
Trait Implementations§
Source§impl Clone for MetricExpr
impl Clone for MetricExpr
Source§fn clone(&self) -> MetricExpr
fn clone(&self) -> MetricExpr
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MetricExpr
impl Debug for MetricExpr
Source§impl<'de> Deserialize<'de> for MetricExpr
impl<'de> Deserialize<'de> for MetricExpr
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for MetricExpr
impl PartialEq for MetricExpr
Source§fn eq(&self, other: &MetricExpr) -> bool
fn eq(&self, other: &MetricExpr) -> bool
self and other values to be equal, and is used by ==.