pub struct State {Show 13 fields
pub status: Status,
pub since: u64,
pub fails: u32,
pub oks: u32,
pub failing_since: Option<u64>,
pub notified: Status,
pub down_since: Option<u64>,
pub downs: Vec<u64>,
pub flapping: bool,
pub cert_warned: Option<u64>,
pub first_check: Option<u64>,
pub never_up: bool,
pub stopped: bool,
}Expand description
A monitor’s state, kept across daemon restarts so a restart never sends a down (or an up) twice.
Fields§
§status: Status§since: u64Unix milliseconds the status began.
fails: u32Failed checks in a row.
oks: u32Successful checks in a row.
failing_since: Option<u64>When the current run of failures began.
notified: StatusWhat channels were last told.
down_since: Option<u64>When the incident channels were told about began.
downs: Vec<u64>Unix milliseconds of recent downs, for flap damping.
flapping: bool§cert_warned: Option<u64>The certificate (by its expiry, unix seconds) already warned about.
first_check: Option<u64>When the first check of a pending monitor ran.
never_up: boolPending for NEVER_UP_MS with only failures.
stopped: boolIts app or stack service is scaled to 0, since State::since.
Implementations§
Source§impl State
impl State
Sourcepub fn observe(&mut self, ok: bool, now: u64, t: Thresholds) -> Step
pub fn observe(&mut self, ok: bool, now: u64, t: Thresholds) -> Step
Take one check’s result at now (unix milliseconds).
Sourcepub fn stop(&mut self, now: u64) -> bool
pub fn stop(&mut self, now: u64) -> bool
Its target was scaled to 0 at now: forget the run it was on, so
starting again waits for the first success like a new monitor.
Returns whether it was not stopped already.
Sourcepub fn reset_counts(&mut self)
pub fn reset_counts(&mut self)
Start counting afresh (a resumed or edited monitor), keeping what channels were told.