pub struct ProcStatus {
pub state: ProcState,
pub ready: Option<bool>,
pub pid: Option<u32>,
pub uptime_secs: Option<u64>,
pub version: Option<String>,
pub detail: Option<String>,
pub endpoints: BTreeMap<String, String>,
pub metrics: BTreeMap<String, f64>,
}Expand description
A workload’s self-description. Only Self::state is required.
Field-for-field the same document yah-cloud’s proc_control client
parses; the two types are separate only because neither side may force its
dependencies on the other.
Fields§
§state: ProcStateLifecycle state, in kamaji’s vocabulary.
ready: Option<bool>Redundant convenience mirror of state == running, accepted from
producers that emit it. Never trusted over state — a document
claiming {"state":"starting","ready":true} is a producer bug, and
believing the optimistic half of it is how a supervisor reports a
half-booted process as up.
pid: Option<u32>Process id. Stamped by ControlServer when the producer leaves it
unset — the helper knows its own pid and cannot get it wrong.
uptime_secs: Option<u64>Seconds since the process considered itself started. Stamped by
ControlServer (from when the control server was started) when the
producer leaves it unset.
version: Option<String>Build/version string, for an operator staring at two of these.
detail: Option<String>One human line elaborating on state — “replaying WAL 3/7”,
“waiting for GPU”. This is the field that replaces log-grepping.
endpoints: BTreeMap<String, String>Named addresses the process serves — {"http":"http://127.0.0.1:4325"}.
A portless process may legitimately name a non-URL surface here.
metrics: BTreeMap<String, f64>Numeric gauges the process wants surfaced. Free-form on purpose: this is a status channel, not a metrics pipeline.
Implementations§
Source§impl ProcStatus
impl ProcStatus
Sourcepub fn with_detail(self, detail: impl Into<String>) -> Self
pub fn with_detail(self, detail: impl Into<String>) -> Self
The one human line that replaces log-grepping.
Sourcepub fn with_version(self, version: impl Into<String>) -> Self
pub fn with_version(self, version: impl Into<String>) -> Self
Build/version string. env!("CARGO_PKG_VERSION") is the usual argument.
Sourcepub fn with_pid(self, pid: u32) -> Self
pub fn with_pid(self, pid: u32) -> Self
Override the pid the server would otherwise stamp — for a producer that supervises something other than itself.
Sourcepub fn with_uptime_secs(self, secs: u64) -> Self
pub fn with_uptime_secs(self, secs: u64) -> Self
Override the uptime the server would otherwise stamp.
Sourcepub fn with_endpoint(
self,
name: impl Into<String>,
addr: impl Into<String>,
) -> Self
pub fn with_endpoint( self, name: impl Into<String>, addr: impl Into<String>, ) -> Self
Name an address this process serves. A portless process may legitimately
name a non-URL surface ("gui" -> "winit://main").
Sourcepub fn with_metric(self, name: impl Into<String>, value: f64) -> Self
pub fn with_metric(self, name: impl Into<String>, value: f64) -> Self
Surface a numeric gauge.
Sourcepub fn is_ready(&self) -> bool
pub fn is_ready(&self) -> bool
Ready iff the state says so. See Self::ready for why the
producer-supplied boolean does not get a vote.
Trait Implementations§
Source§impl Clone for ProcStatus
impl Clone for ProcStatus
Source§fn clone(&self) -> ProcStatus
fn clone(&self) -> ProcStatus
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more