pub struct Health { /* private fields */ }Expand description
Health check registry, see the module documentation. Cloning gives another handle to the same registry.
Implementations§
Source§impl Health
impl Health
pub fn new() -> Self
Sourcepub fn check<F, Fut, E>(self, name: &str, check: F) -> Self
pub fn check<F, Fut, E>(self, name: &str, check: F) -> Self
A dependency the service cannot work without: when it fails, readiness is 503
Sourcepub fn optional<F, Fut, E>(self, name: &str, check: F) -> Self
pub fn optional<F, Fut, E>(self, name: &str, check: F) -> Self
A dependency the service can live without: when it fails, readiness stays
200 but reports degraded
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Longest a single check may take before it counts as failed (default 2 seconds)
Sourcepub fn cache_for(self, ttl: Duration) -> Self
pub fn cache_for(self, ttl: Duration) -> Self
Reuse the last result for this long (default 1 second, zero disables). Concurrent probes share one run of the checks either way.
Sourcepub fn expose_errors(self) -> Self
pub fn expose_errors(self) -> Self
Include the error text of failed checks in the response. Off by default because messages can reveal hostnames and internals.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Health
impl !UnwindSafe for Health
impl Freeze for Health
impl Send for Health
impl Sync for Health
impl Unpin for Health
impl UnsafeUnpin for Health
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more