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.
impl ObservabilityMetric
Inherent implementation of ObservabilityMetric.
Sourcepub fn measured_common(
id: &str,
scope: &str,
unit: ObservabilityUnit,
window: &str,
statistic: ObservabilityStatistic,
value: f64,
) -> Self
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.
Sourcepub fn measured_leak(
id: &str,
scope: &str,
unit: ObservabilityUnit,
window: &str,
baseline: f64,
after_drain: f64,
slope_per_cycle: f64,
) -> Self
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.
Sourcepub fn proxy_common(
id: &str,
scope: &str,
unit: ObservabilityUnit,
window: &str,
statistic: ObservabilityStatistic,
value: f64,
) -> Self
pub fn proxy_common( id: &str, scope: &str, unit: ObservabilityUnit, window: &str, statistic: ObservabilityStatistic, value: f64, ) -> Self
Creates a proxy common scalar metric explicitly marked status = "proxy" and timing_source = "submission_proxy".
§Arguments
&str- Canonical catalog metric ID.&str- Coverage scope name.ObservabilityUnit- Canonical metric unit.&str- Sampling window label.ObservabilityStatistic- Summary statistic tag.f64- Proxy scalar value.
§Returns
Self- Proxy common metric entry.
Sourcepub fn unobservable(
id: &str,
scope: &str,
unit: ObservabilityUnit,
window: &str,
statistic: ObservabilityStatistic,
reason: &str,
) -> Self
pub fn unobservable( id: &str, scope: &str, unit: ObservabilityUnit, window: &str, statistic: ObservabilityStatistic, reason: &str, ) -> Self
Creates an explicitly unobservable metric with value = None (null in JSON) and a required diagnostic reason (never faking zero).
§Arguments
&str- Canonical catalog metric ID.&str- Coverage scope name.ObservabilityUnit- Canonical metric unit.&str- Sampling window label.ObservabilityStatistic- Summary statistic tag.&str- Non-empty reason explaining why the metric is unobservable.
§Returns
Self- Truthful unobservable metric entry.
Sourcepub fn with_timing_source(self, source: &str) -> Self
pub fn with_timing_source(self, source: &str) -> Self
Sourcepub fn with_upload_strategy(self, strategy: &str) -> Self
pub fn with_upload_strategy(self, strategy: &str) -> Self
Sourcepub fn timing_source_value(&self) -> Option<&str>
pub fn timing_source_value(&self) -> Option<&str>
Sourcepub fn reason_value(&self) -> Option<&str>
pub fn reason_value(&self) -> Option<&str>
Sourcepub fn with_samples(self, samples: u64) -> Self
pub fn with_samples(self, samples: u64) -> Self
Sourcepub fn with_threshold(self, threshold: ObservabilityThreshold) -> Self
pub fn with_threshold(self, threshold: ObservabilityThreshold) -> Self
Sourcepub fn with_evidence_refs(self, refs: Vec<String>) -> Self
pub fn with_evidence_refs(self, refs: Vec<String>) -> Self
Sourcepub fn scalar_value(&self) -> Option<f64>
pub fn scalar_value(&self) -> Option<f64>
Sourcepub fn baseline_value(&self) -> Option<f64>
pub fn baseline_value(&self) -> Option<f64>
Sourcepub fn after_drain_value(&self) -> Option<f64>
pub fn after_drain_value(&self) -> Option<f64>
Sourcepub fn slope_per_cycle_value(&self) -> Option<f64>
pub fn slope_per_cycle_value(&self) -> Option<f64>
Sourcepub fn has_any_numeric_value(&self) -> bool
pub fn has_any_numeric_value(&self) -> bool
Source§impl ObservabilityMetric
impl ObservabilityMetric
pub fn get_id(&self) -> &String
pub fn get_scope(&self) -> &String
pub fn get_unit(&self) -> ObservabilityUnit
pub fn get_status(&self) -> ObservabilityMetricStatus
pub fn get_window(&self) -> &String
pub fn get_statistic(&self) -> ObservabilityStatistic
pub fn get_evidence_refs(&self) -> &Vec<String>
Trait Implementations§
Source§impl Clone for ObservabilityMetric
impl Clone for ObservabilityMetric
Source§impl Debug for ObservabilityMetric
impl Debug for ObservabilityMetric
Source§impl<'de> Deserialize<'de> for ObservabilityMetric
impl<'de> Deserialize<'de> for ObservabilityMetric
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ObservabilityMetric
impl PartialEq for ObservabilityMetric
Source§impl Serialize for ObservabilityMetric
impl Serialize for ObservabilityMetric
impl StructuralPartialEq for ObservabilityMetric
Auto Trait Implementations§
impl Forget for ObservabilityMetric
impl Freeze for ObservabilityMetric
impl Move for ObservabilityMetric
impl RefUnwindSafe for ObservabilityMetric
impl Send for ObservabilityMetricwhere
RawVecInner: Send,
impl Sync for ObservabilityMetricwhere
RawVecInner: Sync,
impl Unpin for ObservabilityMetric
impl UnsafeUnpin for ObservabilityMetricwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
impl UnwindSafe for ObservabilityMetricwhere
RawVecInner: UnwindSafe,
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
Mutably borrows from an owned value. Read more