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: u16Schema major version. Must equal
crate::SCHEMA_VERSION_V1 for this endpoint.
observed_at_unix_ms: u64Unix epoch in milliseconds at which the snapshot was produced.
sample_interval_ms: u64Sampling cadence in milliseconds used to derive percentage metrics.
capabilities: MetricCapabilitiesPer-metric capability flags.
system: SystemIdentityStable identity fields reported separately so clients can degrade by width priority.
cpu: CpuMetricsCPU utilization, with optional Linux aggregate I/O wait.
load: LoadAverageOne-, five-, and fifteen-minute load averages.
memory: MemoryMetricsPhysical memory utilization.
swap: SwapMetricsSwap utilization.
Implementations§
Source§impl StatusSnapshot
impl StatusSnapshot
Sourcepub fn validate(&self) -> Result<(), Vec<ValidationViolation>>
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 > 0andsample_interval_ms > 0.cpu.logical_cores > 0.- All percentages are finite and in
0.0..=100.0. used_bytes <= total_bytesfor memory and swap.- When
total_bytes == 0, the correspondingusage_pctis0.0. iowait_pctisNoneexactly whencpu_iowaitcapability isfalse. Atruecapability withNoneis rejected because aReadysnapshot must report every supported metric.
Trait Implementations§
Source§impl Clone for StatusSnapshot
impl Clone for StatusSnapshot
Source§fn clone(&self) -> StatusSnapshot
fn clone(&self) -> StatusSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more