Skip to main content

StatusPayload

Struct StatusPayload 

Source
#[non_exhaustive]
pub struct StatusPayload { pub applications: Option<HashMap<String, ApplicationReport>>, pub health: Vec<HealthCheck>, pub healthy: Option<bool>, pub machine: Option<TargetReport>, pub source: Option<String>, pub extra: Map<String, Value>, }
Expand description

A status push: a server’s periodic heartbeat carrying its self-reported health.

Besides the reserved healthy and health keys described here, any additional top-level fields are accepted and stored verbatim as extra status data.

JSON schema
{
 "description": "A status push: a server's periodic heartbeat carrying its self-reported\nhealth.\n\nBesides the reserved `healthy` and `health` keys described here, any\nadditional top-level fields are accepted and stored verbatim as extra\nstatus data.",
 "type": "object",
 "required": [
   "health"
 ],
 "properties": {
   "applications": {
     "description": "The applications the reporter found on the machine, each with its own\nhealth checks and detail, keyed by a key the reporter chooses.\n\nThe key must be unique among the applications on that machine and must\nidentify the same application across this reporter's pushes; what it is\nderived from is the reporter's own business. Canopy correlates on the\nmachine, the key and the type together, and never discloses its own\nidentifier for an application.\n\nOnly read alongside `machine`. An application named here that Canopy\ndoes not already hold is created.",
     "type": [
       "object",
       "null"
     ],
     "additionalProperties": {
       "$ref": "#/components/schemas/ApplicationReport"
     },
     "propertyNames": {
       "type": "string"
     }
   },
   "health": {
     "description": "Per-check breakdown. A push without a `health` array is the legacy\nTamanu direct-report format: it is treated as the `tamanu` source\nreporting a single always-passing `tasks` heartbeat check. May be\nempty (`[]`) for a source that genuinely runs no checks — which\nrecovers every check it previously reported. Each entry must\ninclude a non-empty `check` name and exactly one of `result` /\n`healthy`; any additional fields per check (latency, free disk %,\ncertificate expiry, etc.) are passed through verbatim and shown in the\nstatus UI.\n\nEvery check name seen — whatever its result — is added to the\noperator-facing check catalog, where the policy grading its results\ncan be reviewed and adjusted. A check whose effective result is\nfailed or warning opens (or keeps open) its issue; a broken check\nkeeps the same issue open, retaining a known failure's contribution\nwhile warning the check itself is broken; effective passed and\nskipped results open nothing and close prior issues.",
     "type": "array",
     "items": {
       "$ref": "#/components/schemas/HealthCheck"
     }
   },
   "healthy": {
     "description": "Overall self-reported health of the server. **Absent means `true`**,\nso senders that predate this field are never treated as unhealthy by\nomission. Recorded for historical analysis and display, but **not\nconsulted for incident or severity decisions** — those are derived\nfrom the per-check results in `health`, with each check's severity\ncontrolled by an operator-managed catalog.",
     "type": [
       "boolean",
       "null"
     ]
   },
   "machine": {
     "oneOf": [
       {
         "type": "null"
       },
       {
         "description": "The machine's own health checks and detail: what the box is, rather\nthan what runs on it.\n\nSending this puts the push in the current format, and Canopy takes the\nseparation as given. A push without it is a transitional unified push,\nwhich Canopy separates into the two grains itself from `health` and the\nflat body.",
         "$ref": "#/components/schemas/TargetReport"
       }
     ]
   },
   "source": {
     "description": "The name of the source pushing this status: the reporting agent, e.g.\n`alertd`. Multiple sources may report on one server, each with its own\nset of checks; a source's push only opens and recovers its own checks.\n\n**Transitionally optional: this field will become mandatory.** A push\nwithout a `source` is attributed to `alertd`; new reporters must send\ntheir own name. Must be a non-empty string; the names `canopy` and\n`manual` are reserved for canopy itself and are rejected.",
     "type": [
       "string",
       "null"
     ]
   }
 },
 "additionalProperties": true
}

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§applications: Option<HashMap<String, ApplicationReport>>

The applications the reporter found on the machine, each with its own health checks and detail, keyed by a key the reporter chooses.

The key must be unique among the applications on that machine and must identify the same application across this reporter’s pushes; what it is derived from is the reporter’s own business. Canopy correlates on the machine, the key and the type together, and never discloses its own identifier for an application.

Only read alongside machine. An application named here that Canopy does not already hold is created.

§health: Vec<HealthCheck>

Per-check breakdown. A push without a health array is the legacy Tamanu direct-report format: it is treated as the tamanu source reporting a single always-passing tasks heartbeat check. May be empty ([]) for a source that genuinely runs no checks — which recovers every check it previously reported. Each entry must include a non-empty check name and exactly one of result / healthy; any additional fields per check (latency, free disk %, certificate expiry, etc.) are passed through verbatim and shown in the status UI.

Every check name seen — whatever its result — is added to the operator-facing check catalog, where the policy grading its results can be reviewed and adjusted. A check whose effective result is failed or warning opens (or keeps open) its issue; a broken check keeps the same issue open, retaining a known failure’s contribution while warning the check itself is broken; effective passed and skipped results open nothing and close prior issues.

§healthy: Option<bool>

Overall self-reported health of the server. Absent means true, so senders that predate this field are never treated as unhealthy by omission. Recorded for historical analysis and display, but not consulted for incident or severity decisions — those are derived from the per-check results in health, with each check’s severity controlled by an operator-managed catalog.

§machine: Option<TargetReport>§source: Option<String>

The name of the source pushing this status: the reporting agent, e.g. alertd. Multiple sources may report on one server, each with its own set of checks; a source’s push only opens and recovers its own checks.

Transitionally optional: this field will become mandatory. A push without a source is attributed to alertd; new reporters must send their own name. Must be a non-empty string; the names canopy and manual are reserved for canopy itself and are rejected.

§extra: Map<String, Value>

Any further keys the schema accepts alongside those above, carried verbatim.

Implementations§

Source§

impl StatusPayload

Source

pub fn builder() -> StatusPayloadBuilder

Create an instance of StatusPayload using the builder syntax

Trait Implementations§

Source§

impl Clone for StatusPayload

Source§

fn clone(&self) -> StatusPayload

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 StatusPayload

Source§

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

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

impl<'de> Deserialize<'de> for StatusPayload

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 Serialize for StatusPayload

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

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.