Skip to main content

StatusSnapshot

Struct StatusSnapshot 

Source
pub struct StatusSnapshot {
    pub schema_version: u16,
    pub observed_at_unix_ms: u64,
    pub sample_interval_ms: u64,
    pub capabilities: MetricCapabilities,
    pub system: SystemIdentity,
    pub cpu: CpuMetrics,
    pub load: LoadAverage,
    pub memory: MemoryMetrics,
    pub swap: SwapMetrics,
}
Expand description

Top-level daemon snapshot returned by the status endpoint.

Every numeric field uses raw units. CPU and memory percentages are reported in the closed interval 0.0..=100.0. Bytes are unsigned 64-bit counts. observed_at_unix_ms is the Unix epoch in milliseconds at which the underlying counters were sampled.

CPU percentage values are derived from sampling-interval deltas, not from instantaneous single reads, so a freshly started daemon may legitimately report a snapshot whose CPU usage is still unknown. Such snapshots surface through the HealthResponse instead of through this endpoint.

Fields§

§schema_version: u16

Schema major version. Must equal crate::SCHEMA_VERSION_V1 for this endpoint.

§observed_at_unix_ms: u64

Unix epoch in milliseconds at which the snapshot was produced.

§sample_interval_ms: u64

Sampling cadence in milliseconds used to derive percentage metrics.

§capabilities: MetricCapabilities

Per-metric capability flags.

§system: SystemIdentity

Stable identity fields reported separately so clients can degrade by width priority.

§cpu: CpuMetrics

CPU utilization, with optional Linux aggregate I/O wait.

§load: LoadAverage

One-, five-, and fifteen-minute load averages.

§memory: MemoryMetrics

Physical memory utilization.

§swap: SwapMetrics

Swap utilization.

Implementations§

Source§

impl StatusSnapshot

Source

pub fn validate(&self) -> Result<(), Vec<ValidationViolation>>

Validate that every field satisfies the version-1 protocol invariants.

The returned ValidationViolation list is structured so callers can log individual fields and decide whether to reject the snapshot, surface it as a warning, or fall back to a warming-up health response.

§Invariants
  • schema_version == SCHEMA_VERSION_V1.
  • observed_at_unix_ms > 0 and sample_interval_ms > 0.
  • cpu.logical_cores > 0.
  • All percentages are finite and in 0.0..=100.0.
  • used_bytes <= total_bytes for memory and swap.
  • When total_bytes == 0, the corresponding usage_pct is 0.0.
  • iowait_pct is None exactly when cpu_iowait capability is false. A true capability with None is rejected because a Ready snapshot must report every supported metric.

Trait Implementations§

Source§

impl Clone for StatusSnapshot

Source§

fn clone(&self) -> StatusSnapshot

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 StatusSnapshot

Source§

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

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

impl<'de> Deserialize<'de> for StatusSnapshot

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 StatusSnapshot

Source§

fn eq(&self, other: &StatusSnapshot) -> 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 StatusSnapshot

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 StatusSnapshot

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.