This Feature is used by the kairo-sample repository.
Kairo's Health Check Feature configures liveness and readiness health check REST endpoints:
GET /health/liveness
is designed to always respond with200 OK
and no response body. This can be used to check if the Server is running. The Server may or may not be ready to receive traffic.GET /health/readiness
is designed to run custom health checks, and respond with either200 OK
or500 Internal Server Error
depending on the status of those health checks.
// build.gradle.kts
dependencies {
implementation("kairo:kairo-health-check-feature:$kairoVersion")
}
// src/main/kotlin/yourPackage/server/monolith/MonolithHealthCheckService.kt
internal class MonolithHealthCheckService @Inject constructor() : HealthCheckService() {
override val healthChecks: Map<String, HealthCheck> =
mapOf(
"server" to HealthCheck { serverHealthCheck() },
"custom" to HealthCheck { customHealthCheck() },
)
private fun customHealthCheck(): HealthCheckRep.Status {
TODO("Your custom health check.")
}
}
// src/main/kotlin/yourPackage/server/monolith/MonolithServer.kt
KairoHealthCheckFeature(MonolithHealthCheckService::class)