Skip to content

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 validation
  • GET /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

pub

Derives: Clone

Shared state for health endpoints

Name Type Description
k8s_client Client
broker_status Arc<RwLock<BrokerStatus>>
start_time SystemTime

pub

Derives: Clone

Broker connection status

Name Type Description
connected bool
last_heartbeat Option<String>

pub

fn configure_health_routes(state: HealthState) -> Router

Configures 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)
}