Skip to main content

Module health

Module health 

Source
Expand description

Health check system for monitoring application health

This module provides a flexible health check system for monitoring the health and readiness of your application and its dependencies.

§Example

use rustapi_core::health::{HealthCheck, HealthCheckBuilder, HealthStatus};

#[tokio::main]
async fn main() {
    let health = HealthCheckBuilder::new(true)
        .add_check("database", || async {
            // Check database connection
            HealthStatus::healthy()
        })
        .add_check("redis", || async {
            // Check Redis connection
            HealthStatus::healthy()
        })
        .build();

    // Use health.execute().await to get results
}

Structs§

HealthCheck
Health check configuration
HealthCheckBuilder
Builder for health check configuration
HealthCheckResult
Overall health check result
HealthEndpointConfig
Configuration for built-in health endpoints.
HealthResponse
JSON health response used by RustAPI’s built-in health endpoints.

Enums§

HealthStatus
Health status of a component

Functions§

health_response
Execute an aggregated health check and return an HTTP-friendly response.
liveness_response
Return a lightweight liveness probe response.
readiness_response
Execute a readiness probe based on the configured health checks.

Type Aliases§

HealthCheckFn
Type alias for async health check functions