pub struct EndpointHealth {
pub endpoint: String,
/* private fields */
}Expand description
Health tracking for a single endpoint.
Fields§
§endpoint: StringThe endpoint URL.
Implementations§
Source§impl EndpointHealth
impl EndpointHealth
Sourcepub fn status(&self) -> HealthStatus
pub fn status(&self) -> HealthStatus
Get the current health status.
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
Check if the endpoint is healthy.
Sourcepub async fn record_success(&self)
pub async fn record_success(&self)
Record a successful request.
Sourcepub async fn record_failure(&self, failure_threshold: usize)
pub async fn record_failure(&self, failure_threshold: usize)
Record a failed request.
Sourcepub async fn record_health_check(&self, healthy: bool, failure_threshold: usize)
pub async fn record_health_check(&self, healthy: bool, failure_threshold: usize)
Record a health check.
Sourcepub fn consecutive_failures(&self) -> usize
pub fn consecutive_failures(&self) -> usize
Get the number of consecutive failures.
Sourcepub fn total_requests(&self) -> u64
pub fn total_requests(&self) -> u64
Get the total number of requests.
Sourcepub fn total_failures(&self) -> u64
pub fn total_failures(&self) -> u64
Get the total number of failures.
Sourcepub fn failure_rate(&self) -> f64
pub fn failure_rate(&self) -> f64
Get the failure rate (0.0 to 1.0).
Sourcepub async fn last_success(&self) -> Option<Instant>
pub async fn last_success(&self) -> Option<Instant>
Get the last successful request time.
Sourcepub async fn last_health_check(&self) -> Option<Instant>
pub async fn last_health_check(&self) -> Option<Instant>
Get the last health check time.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for EndpointHealth
impl !RefUnwindSafe for EndpointHealth
impl Send for EndpointHealth
impl Sync for EndpointHealth
impl Unpin for EndpointHealth
impl !UnwindSafe for EndpointHealth
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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request