pub struct HealthChecker { /* private fields */ }
Expand description
Health checker for monitoring provider health and performance.
Manages health checks, tracks performance metrics, and provides health status information for routing decisions.
§Thread Safety
All operations are thread-safe and can be used concurrently.
§Example
let mut health_checker = HealthChecker::new();
health_checker.set_config(routing_config);
let status = health_checker.check_provider_health("openai", &provider).await;
Implementations§
Source§impl HealthChecker
impl HealthChecker
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new health checker instance.
Initializes an empty health checker with no configuration.
Use set_config()
to configure health check behavior.
§Returns
Returns a new HealthChecker
instance.
Sourcepub fn set_config(&mut self, config: RoutingConfig)
pub fn set_config(&mut self, config: RoutingConfig)
Set the routing configuration for health checks.
Configures health check intervals, thresholds, and other routing-related settings.
§Arguments
config
- Routing configuration with health check settings
Sourcepub async fn check_provider_health(
&mut self,
provider_id: &str,
provider: &Arc<dyn Provider>,
) -> ProviderHealthStatus
pub async fn check_provider_health( &mut self, provider_id: &str, provider: &Arc<dyn Provider>, ) -> ProviderHealthStatus
pub fn get_healthy_providers(&self) -> Vec<String>
pub fn should_use_provider(&self, provider_id: &str) -> bool
pub fn get_provider_stats(&self) -> HashMap<String, ProviderHealthStatus>
pub fn is_provider_healthy(&self, provider_id: &str) -> bool
Trait Implementations§
Source§impl Debug for HealthChecker
impl Debug for HealthChecker
Auto Trait Implementations§
impl Freeze for HealthChecker
impl RefUnwindSafe for HealthChecker
impl Send for HealthChecker
impl Sync for HealthChecker
impl Unpin for HealthChecker
impl UnwindSafe for HealthChecker
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