Skip to main content

EndpointHealth

Struct EndpointHealth 

Source
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: u8

Count of consecutive failed probes since the last success. Caps at EndpointHealth::FAIL_THRESHOLD (any higher is irrelevant — the endpoint is already Unhealthy).

§consecutive_successes: u8

Count 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

Source

pub const FAIL_THRESHOLD: u8 = 3

Consecutive failures required to flip Healthy → Unhealthy (ADR-0021).

Source

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.

Source

pub fn fresh_healthy(now_unix: i64) -> Self

Initial health for an endpoint just admitted by the CP’s admission-time /healthz probe.

Source

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.

Source

pub fn on_probe_failure(self, now_unix: i64) -> Self

Fold a failed probe into this state.

Source

pub fn is_healthy(&self) -> bool

True iff the endpoint is currently classified Healthy.

Trait Implementations§

Source§

impl Clone for EndpointHealth

Source§

fn clone(&self) -> EndpointHealth

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 EndpointHealth

Source§

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

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

impl<'de> Deserialize<'de> for EndpointHealth

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 EndpointHealth

Source§

fn eq(&self, other: &EndpointHealth) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for EndpointHealth

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 Eq for EndpointHealth

Source§

impl StructuralPartialEq for EndpointHealth

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> 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,