pub struct Monitors { /* private fields */ }Expand description
The monitoring service.
Implementations§
Source§impl Monitors
impl Monitors
pub fn new( state: &Path, apps: Apps, secrets: Arc<Secrets>, allow_private: AllowPrivate, public_url: Option<String>, ) -> Monitors
Sourcepub fn with_tls(self, tls: Arc<ClientConfig>) -> Monitors
pub fn with_tls(self, tls: Arc<ClientConfig>) -> Monitors
Trust these TLS roots instead of the public set (tests).
pub fn list(&self, org: &OrgId) -> Result<Vec<Monitor>>
pub fn get(&self, org: &OrgId, name: &str) -> Result<Monitor>
pub fn settings(&self, org: &OrgId) -> Result<Settings>
pub fn set_settings(&self, org: &OrgId, s: &Settings) -> Result<()>
pub fn create(&self, org: &OrgId, m: Monitor) -> Result<Monitor>
Sourcepub fn update(
&self,
org: &OrgId,
name: &str,
patch: Map<String, Value>,
) -> Result<Monitor>
pub fn update( &self, org: &OrgId, name: &str, patch: Map<String, Value>, ) -> Result<Monitor>
Change fields of a monitor: patch holds the fields to set (null
puts a field back to its default). The name stays.
Sourcepub fn delete(&self, org: &OrgId, name: &str) -> Result<Monitor>
pub fn delete(&self, org: &OrgId, name: &str) -> Result<Monitor>
Remove a monitor and its history. An app’s or a stack service’s own monitor stays away: it joins the org’s exclusions.
Sourcepub fn following(&self, org: &OrgId, targets: &[Target]) -> Result<Vec<String>>
pub fn following(&self, org: &OrgId, targets: &[Target]) -> Result<Vec<String>>
The monitors that follow any of targets: their own, and the app
and service monitors made for them.
Sourcepub fn remove_following(
&self,
org: &OrgId,
targets: &[Target],
) -> Result<Vec<String>>
pub fn remove_following( &self, org: &OrgId, targets: &[Target], ) -> Result<Vec<String>>
Remove the monitors that follow targets, with their history, as
the targets themselves go. Unlike Monitors::delete the targets
leave the org’s exclusions rather than join them, so an app made
again under the same name gets its own monitor again. Returns the
names removed.
pub fn set_paused( &self, org: &OrgId, name: &str, paused: bool, ) -> Result<Monitor>
Sourcepub fn sync_auto(&self, org: &OrgId) -> Result<()>
pub fn sync_auto(&self, org: &OrgId) -> Result<()>
Give every app and compose stack service with a served domain its
own monitor, and remove those whose target is gone, has no domains,
or opted out (auto).
pub fn shutdown(&self)
Sourcepub fn stopper(&self) -> Arc<AtomicBool> ⓘ
pub fn stopper(&self) -> Arc<AtomicBool> ⓘ
Set by Monitors::shutdown: what the heartbeat stops on too.
Sourcepub fn check(&self, org: &OrgId, m: &Monitor) -> Outcome
pub fn check(&self, org: &OrgId, m: &Monitor) -> Outcome
Run one check now. An app’s or stack service’s monitor that has not been up yet does not look at it until it has a live deployment: the check fails as “waiting”, which the state machine keeps as pending.
Sourcepub fn rest(&self, org: &OrgId, m: &Monitor) -> Result<()>
pub fn rest(&self, org: &OrgId, m: &Monitor) -> Result<()>
Its app or stack service is stopped: no check. The first time, the monitor turns stopped and an open incident closes, telling no one.
Sourcepub fn record(&self, org: &OrgId, m: &Monitor, o: Outcome) -> Result<()>
pub fn record(&self, org: &OrgId, m: &Monitor, o: Outcome) -> Result<()>
Keep a check’s result, step the state machine, raise events.
Source§impl Monitors
impl Monitors
Sourcepub fn summary(&self, org: &OrgId, m: &Monitor) -> Result<Value>
pub fn summary(&self, org: &OrgId, m: &Monitor) -> Result<Value>
One monitor as listings show it: its definition, status (up, down,
pending, paused, or stopped: its app or stack service is scaled to
0), never_up (pending for 30 minutes with only failures), the last
check, uptime over 24 h, 7 d and 30 d, latency
p50/p95 over 24 h, 24 hourly bars ([start, uptime, pending checks])
and the last 30 latencies.
Sourcepub fn overview(&self, org: &OrgId) -> Result<Value>
pub fn overview(&self, org: &OrgId) -> Result<Value>
Every monitor of the org, its recent incidents and its settings.