Skip to main content

ObservabilityMetric

Struct ObservabilityMetric 

Source
pub struct ObservabilityMetric { /* private fields */ }
Expand description

Single unified metric entry conforming to schemas/report-v1.schema.json and metrics/catalog-v1.json.

Implementations§

Source§

impl ObservabilityMetric

Inherent implementation of ObservabilityMetric.

Source

pub fn measured_common( id: &str, scope: &str, unit: ObservabilityUnit, window: &str, statistic: ObservabilityStatistic, value: f64, ) -> Self

Creates a measured common scalar metric conforming to schemas/report-v1.schema.json.

§Arguments
  • &str - Canonical catalog metric ID.
  • &str - Coverage scope name.
  • ObservabilityUnit - Canonical metric unit.
  • &str - Sampling window label.
  • ObservabilityStatistic - Summary statistic tag.
  • f64 - Measured scalar value.
§Returns
  • Self - Measured common metric entry.
Source

pub fn measured_leak( id: &str, scope: &str, unit: ObservabilityUnit, window: &str, baseline: f64, after_drain: f64, slope_per_cycle: f64, ) -> Self

Creates a measured leak/lifecycle metric carrying explicit baseline, after_drain, and slope_per_cycle.

§Arguments
  • &str - Canonical catalog leak metric ID.
  • &str - Coverage scope name.
  • ObservabilityUnit - Canonical metric unit.
  • &str - Sampling window label.
  • f64 - Post-warmup baseline value.
  • f64 - Post-drain value.
  • f64 - Linear slope per lifecycle cycle.
§Returns
  • Self - Measured leak metric entry.
Source

pub fn with_samples(self, samples: u64) -> Self

Attaches a sample count to this metric entry.

§Arguments
  • Self - Metric builder.
  • u64 - Sample count collected during the window.
§Returns
  • Self - Updated metric entry.
Source

pub fn with_threshold(self, threshold: ObservabilityThreshold) -> Self

Attaches a budget threshold to this metric entry.

§Arguments
  • Self - Metric builder.
  • ObservabilityThreshold - Budget threshold contract.
§Returns
  • Self - Updated metric entry.
Source

pub fn with_evidence_refs(self, refs: Vec<String>) -> Self

Attaches linked evidence identifiers to this metric entry.

§Arguments
  • Self - Metric builder.
  • Vec<String> - Evidence reference IDs.
§Returns
  • Self - Updated metric entry.
Source

pub fn scalar_value(&self) -> Option<f64>

Returns the measured scalar value when present.

§Arguments
  • &Self - Metric reference.
§Returns
  • Option<f64> - Scalar value.
Source

pub fn baseline_value(&self) -> Option<f64>

Returns the baseline leak measurement when present.

§Arguments
  • &Self - Metric reference.
§Returns
  • Option<f64> - Baseline value.
Source

pub fn after_drain_value(&self) -> Option<f64>

Returns the post-drain leak measurement when present.

§Arguments
  • &Self - Metric reference.
§Returns
  • Option<f64> - Post-drain value.
Source

pub fn slope_per_cycle_value(&self) -> Option<f64>

Returns the per-cycle leak slope when present.

§Arguments
  • &Self - Metric reference.
§Returns
  • Option<f64> - Slope per cycle.
Source

pub fn has_any_numeric_value(&self) -> bool

Returns true if any numeric sample field (value, baseline, after_drain, slope_per_cycle) is populated.

§Arguments
  • &Self - Metric reference.
§Returns
  • bool - Whether numeric measurements are present.
Source§

impl ObservabilityMetric

Trait Implementations§

Source§

impl Clone for ObservabilityMetric

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ObservabilityMetric

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ObservabilityMetric

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ObservabilityMetric

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ObservabilityMetric

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ObservabilityMetric

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.