pub struct Engine { /* private fields */ }Expand description
A compiled, topologically ordered set of metric programs, split by scope:
node-scope (per node) and graph-scope (once over the whole node set, via the
agg(key, reducer, population) reducer function).
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn compile(
defs: &BTreeMap<String, MetricDef>,
) -> Result<Engine, RegistryError>
pub fn compile( defs: &BTreeMap<String, MetricDef>, ) -> Result<Engine, RegistryError>
Compile and order both scopes of a registry. Detects formula parse errors and dependency cycles (within each scope) up front.
Sourcepub fn has_graph_metrics(&self) -> bool
pub fn has_graph_metrics(&self) -> bool
Does this registry declare any graph-scope (aggregate) metrics?
Sourcepub fn eval_node(
&self,
attrs: &BTreeMap<String, f64>,
strings: &BTreeMap<String, String>,
) -> BTreeMap<String, f64>
pub fn eval_node( &self, attrs: &BTreeMap<String, f64>, strings: &BTreeMap<String, String>, ) -> BTreeMap<String, f64>
Evaluate every node-scope metric over attrs (a node’s numeric values)
plus strings (its string values + derived path fields, so a formula can
branch on path/name/… e.g. path.contains("/generated/") ? 0.0 : hk).
Returns only the newly computed keys. A formula that errors or yields a
non-finite value contributes nothing (the metric is omitted for that node),
mirroring the viewer’s evalCalc and omit_at semantics.
Sourcepub fn eval_graph(&self, pops: &Populations) -> BTreeMap<String, f64>
pub fn eval_graph(&self, pops: &Populations) -> BTreeMap<String, f64>
Evaluate the graph-scope (aggregate) metrics once over the whole node set,
captured as Populations. Formulas use the agg(key, reducer, population) reducer function (e.g. agg('cyclomatic', 'p90', 'not_empty')) and may reference earlier graph metrics by name. Empty /
non-finite results are omitted. Returns the produced aggregate values.
Auto Trait Implementations§
impl Freeze for Engine
impl RefUnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
impl UnwindSafe for Engine
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer