pub enum MetricCheck {
Min {
metric: &'static str,
value: f64,
},
Max {
metric: &'static str,
value: f64,
},
Range {
metric: &'static str,
lo: f64,
hi: f64,
},
Exists(&'static str),
ExitCodeEq(i32),
}Expand description
Assertion check evaluated against an extracted
PayloadMetrics (or the exit code for
MetricCheck::ExitCodeEq).
Variants§
Min
Fail when the named metric is below value.
Max
Fail when the named metric exceeds value.
Range
Fail when the named metric is outside [lo, hi].
Exists(&'static str)
Fail when the named metric is missing from the extracted set.
ExitCodeEq(i32)
Fail when the payload’s exit code is not equal to expected.
Implementations§
Source§impl MetricCheck
impl MetricCheck
Sourcepub const fn min(metric: &'static str, value: f64) -> MetricCheck
pub const fn min(metric: &'static str, value: f64) -> MetricCheck
Fail when the named metric is below value. Missing metric
fails loudly per the evaluation pipeline’s missing-metric
contract.
Sourcepub const fn max(metric: &'static str, value: f64) -> MetricCheck
pub const fn max(metric: &'static str, value: f64) -> MetricCheck
Fail when the named metric exceeds value. Missing metric
fails loudly.
Sourcepub const fn range(metric: &'static str, lo: f64, hi: f64) -> MetricCheck
pub const fn range(metric: &'static str, lo: f64, hi: f64) -> MetricCheck
Fail when the named metric falls outside [lo, hi] (inclusive
on both ends). Missing metric fails loudly.
§Panics
Panics at construction when lo > hi — a reversed-bounds
range describes an empty interval that no finite metric can
satisfy, almost certainly a user error rather than an
intentional always-fails check. Failing at the constructor
surfaces the typo at the call site instead of letting the
evaluator run an unsatisfiable check against every probe
value. NaN bounds also trip this gate because lo <= hi
is false for any NaN argument.
Sourcepub const fn exists(metric: &'static str) -> MetricCheck
pub const fn exists(metric: &'static str) -> MetricCheck
Fail when the named metric is absent from the extracted set. Presence-only — the metric value can be any finite number, including zero or negative.
Sourcepub const fn exit_code_eq(expected: i32) -> MetricCheck
pub const fn exit_code_eq(expected: i32) -> MetricCheck
Fail when the payload’s exit code differs from expected.
Evaluated before metric-path checks so a mis-exited binary
reports the exit-code mismatch rather than chained
missing-metric failures.
Sourcepub const fn min_builtin(metric: BuiltinMetric, value: f64) -> MetricCheck
pub const fn min_builtin(metric: BuiltinMetric, value: f64) -> MetricCheck
Typed sibling of Self::min — a typo-proof BuiltinMetric instead of a
registry-name string. const (via BuiltinMetric::wire_name) so it
composes in const payload-check tables exactly like Self::min. Use
this for a registered built-in metric; keep Self::min for the dynamic
keyspace (dotted JSON-leaf paths from OutputFormat::Json, scheduler-runtime keys).
use ktstr::prelude::*;
// The typed checks compose into a `const` table — exactly the
// `&'static [MetricCheck]` a `Payload` carries in `default_checks`:
const CHECKS: &[MetricCheck] = &[
MetricCheck::min_builtin(BuiltinMetric::TaobenchTotalQps, 1000.0),
MetricCheck::exists_builtin(BuiltinMetric::SchbenchLoopCount),
];
assert_eq!(CHECKS.len(), 2);Sourcepub const fn max_builtin(metric: BuiltinMetric, value: f64) -> MetricCheck
pub const fn max_builtin(metric: BuiltinMetric, value: f64) -> MetricCheck
Typed sibling of Self::max — see Self::min_builtin.
Sourcepub const fn range_builtin(
metric: BuiltinMetric,
lo: f64,
hi: f64,
) -> MetricCheck
pub const fn range_builtin( metric: BuiltinMetric, lo: f64, hi: f64, ) -> MetricCheck
Typed sibling of Self::range — see Self::min_builtin. Same
reversed-bounds construction panic as Self::range.
Sourcepub const fn exists_builtin(metric: BuiltinMetric) -> MetricCheck
pub const fn exists_builtin(metric: BuiltinMetric) -> MetricCheck
Typed sibling of Self::exists — see Self::min_builtin.
Trait Implementations§
Source§impl Clone for MetricCheck
impl Clone for MetricCheck
Source§fn clone(&self) -> MetricCheck
fn clone(&self) -> MetricCheck
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MetricCheck
impl Debug for MetricCheck
impl Copy for MetricCheck
Auto Trait Implementations§
impl Freeze for MetricCheck
impl RefUnwindSafe for MetricCheck
impl Send for MetricCheck
impl Sync for MetricCheck
impl Unpin for MetricCheck
impl UnwindSafe for MetricCheck
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more