brokkr-agent::health
Rust
Health Check Module
This module provides HTTP health check endpoints for the Brokkr Agent. These endpoints are used by Kubernetes for liveness and readiness probes.
Endpoints
GET /healthz: Simple liveness check (returns 200 OK if process is alive)GET /readyz: Readiness check with Kubernetes API connectivity validationGET /health: Detailed health status with JSON response
Health Status Structure
The /health endpoint returns:
- Overall health status
- Kubernetes API connection status
- Broker connection status
- Service uptime
- Application version
- Timestamp
Structs
Section titled “Structs”struct HealthState
Section titled “struct HealthState”pub
Derives: Clone
Shared state for health endpoints
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
k8s_client |
Client |
|
broker_status |
Arc<RwLock<BrokerStatus>> |
|
start_time |
SystemTime |
struct BrokerStatus
Section titled “struct BrokerStatus”pub
Derives: Clone
Broker connection status
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
connected |
bool |
|
last_heartbeat |
Option<String> |
Functions
Section titled “Functions”fn configure_health_routes
Section titled “fn configure_health_routes”pub
fn configure_health_routes(state: HealthState) -> RouterConfigures and returns the health check router
Source
pub fn configure_health_routes(state: HealthState) -> Router { Router::new() .route("/healthz", get(healthz)) .route("/readyz", get(readyz)) .route("/health", get(health)) .route("/metrics", get(metrics_handler)) .with_state(state)}