Health Check
Add health check endpoints to your Kairo application with just a few lines of code.
val healthChecks = mapOf( "sql" to HealthCheck { SqlFeature.healthCheck(koin) }, "custom" to HealthCheck { // ... },)Installation
Section titled “Installation”Install kairo-health-check-feature.
dependencies { implementation("software.airborne.kairo:kairo-health-check-feature")}val features = listOf( HealthCheckFeature(),)This creates 2 endpoints.
GET /health/livenessreturns 200 OK if the server is running.GET /health/readinessreturns 200 OK if all health checks pass.
Customizing health checks
Section titled “Customizing health checks”You’re probably going to want to customize the readiness checks.
Implement the HealthCheck functional interface.
Throw an exception to fail the check.
val healthChecks = mapOf( "sql" to HealthCheck { SqlFeature.healthCheck(koin) }, "custom" to HealthCheck { // ... },)
val features = listOf( HealthCheckFeature(healthChecks),)Built-in health checks
Section titled “Built-in health checks”Depending on which other Framework Features you’re using, you might get other health checks for free.
- SQL Feature
HealthCheck { SqlFeature.healthCheck(koin) }
Advanced Feature configuration
Section titled “Advanced Feature configuration”The Health Check Feature has a few more options you can configure.
includeDefaultHealthCheckistrueby default. This check ensures that the Server is running. If the server is still starting, or has begun stopping, it will fail.timeoutis 2 seconds by default. You can adjust this if needed.