pub struct EndpointHealth {
pub status: HealthStatus,
pub consecutive_fails: u8,
pub consecutive_successes: u8,
pub last_probe_unix: Option<i64>,
}Expand description
Persisted health state for a single Endpoint. Kept inline in
the reachable_at JSONB so a control-plane restart doesn’t reset
the debounce counters; this means a flapping endpoint that was
about to flip Unhealthy keeps its accrued failure count across
deploys.
Fields§
§status: HealthStatus§consecutive_fails: u8Count of consecutive failed probes since the last success.
Caps at EndpointHealth::FAIL_THRESHOLD (any higher is
irrelevant — the endpoint is already Unhealthy).
consecutive_successes: u8Count of consecutive successful probes since the last failure.
Caps at EndpointHealth::SUCCESS_THRESHOLD.
last_probe_unix: Option<i64>Unix seconds of the most recent probe attempt. None if the
background monitor hasn’t run yet.
Implementations§
Source§impl EndpointHealth
impl EndpointHealth
Sourcepub const FAIL_THRESHOLD: u8 = 3
pub const FAIL_THRESHOLD: u8 = 3
Consecutive failures required to flip Healthy → Unhealthy
(ADR-0021).
Sourcepub const SUCCESS_THRESHOLD: u8 = 2
pub const SUCCESS_THRESHOLD: u8 = 2
Consecutive successes required to flip Unhealthy → Healthy
(ADR-0021). Deliberately higher friction than the failure
threshold — a flapping endpoint should not race a recipient’s
connection attempt.
Sourcepub fn fresh_healthy(now_unix: i64) -> Self
pub fn fresh_healthy(now_unix: i64) -> Self
Initial health for an endpoint just admitted by the CP’s
admission-time /healthz probe.
Sourcepub fn on_probe_success(self, now_unix: i64) -> Self
pub fn on_probe_success(self, now_unix: i64) -> Self
Fold a successful probe into this state. Returns self for
ergonomic fold/for reassignment in loops.
Sourcepub fn on_probe_failure(self, now_unix: i64) -> Self
pub fn on_probe_failure(self, now_unix: i64) -> Self
Fold a failed probe into this state.
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
True iff the endpoint is currently classified Healthy.
Trait Implementations§
Source§impl Clone for EndpointHealth
impl Clone for EndpointHealth
Source§fn clone(&self) -> EndpointHealth
fn clone(&self) -> EndpointHealth
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EndpointHealth
impl Debug for EndpointHealth
Source§impl<'de> Deserialize<'de> for EndpointHealth
impl<'de> Deserialize<'de> for EndpointHealth
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>,
Source§impl PartialEq for EndpointHealth
impl PartialEq for EndpointHealth
Source§fn eq(&self, other: &EndpointHealth) -> bool
fn eq(&self, other: &EndpointHealth) -> bool
self and other values to be equal, and is used by ==.