pub struct HealthCheck {
pub component: String,
pub status: HealthStatus,
pub message: String,
pub timestamp: Instant,
pub response_time: Duration,
pub metrics: HashMap<String, f64>,
}Expand description
Health check result
Fields§
§component: StringComponent name
status: HealthStatusHealth status
message: StringStatus message
timestamp: InstantCheck timestamp
response_time: DurationResponse time
metrics: HashMap<String, f64>Additional metrics
Implementations§
Source§impl HealthCheck
impl HealthCheck
Sourcepub fn healthy(component: impl Into<String>, message: impl Into<String>) -> Self
pub fn healthy(component: impl Into<String>, message: impl Into<String>) -> Self
Create a healthy check
Sourcepub fn degraded(
component: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn degraded( component: impl Into<String>, message: impl Into<String>, ) -> Self
Create a degraded check
Sourcepub fn unhealthy(
component: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn unhealthy( component: impl Into<String>, message: impl Into<String>, ) -> Self
Create an unhealthy check
Sourcepub fn with_metric(self, name: impl Into<String>, value: f64) -> Self
pub fn with_metric(self, name: impl Into<String>, value: f64) -> Self
Add a metric
Sourcepub fn with_response_time(self, duration: Duration) -> Self
pub fn with_response_time(self, duration: Duration) -> Self
Set response time
Trait Implementations§
Source§impl Clone for HealthCheck
impl Clone for HealthCheck
Source§fn clone(&self) -> HealthCheck
fn clone(&self) -> HealthCheck
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HealthCheck
impl RefUnwindSafe for HealthCheck
impl Send for HealthCheck
impl Sync for HealthCheck
impl Unpin for HealthCheck
impl UnsafeUnpin for HealthCheck
impl UnwindSafe for HealthCheck
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more