A health check reports whether an application or dependency is working. Its UP or DOWN result lets an operator spot a problem and lets an automated platform respond. Unlike a metric, which reports a numeric value, a health check gives a binary status. section 10.0 section 10.3
Choose a check according to the response a failure should prompt:
- Liveness indicates whether the application can continue running. A failed Kubernetes liveness probe can restart its pod. section 10.2
- Readiness indicates whether the application can receive traffic now. A failed readiness probe can keep traffic away until the condition clears. section 10.2
- Startup indicates that initialization has finished. Kubernetes uses its startup probe during initial startup; liveness and readiness take over after it passes. section 10.2
- Wellness reports less severe problems that do not warrant a restart or traffic hold-off. SmallRye Health adds wellness and custom health groups beyond MicroProfile Health. section 10.2 section 10.8
In Quarkus, add the SmallRye Health extension with `quarkus extension add smallrye-health`. MicroProfile Health checks are exposed over HTTP: `/q/health` returns the combined JSON result, while `/q/health/live`, `/q/health/ready`, `/q/health/started`, and `/q/health/well` select check types. The Dev UI also offers a human-readable Health UI for development. section 10.2.1 section 10.8
Check a database dependency
An Inventory service using a JDBC data source gets a readiness check automatically. With its MySQL connection working, the database check reports UP. Stop the database container and the check reports DOWN with a connection error: the service cannot process requests at that moment. Restart the container to restore the dependency. section 10.2.1
Listing 10.3 Wellness check reporting DOWN if the inventory is empty
package org.acme.inventory.health;
import io.smallrye.health.api.Wellness;
import jakarta.inject.Inject;
import org.acme.inventory.repository.CarRepository;
import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;
@Wellness
public class CarCountCheck implements HealthCheck {
@Inject
CarRepository carRepository;
@Override
public HealthCheckResponse call() {
long carsCount = carRepository.findAll().count();
boolean wellnessStatus = carsCount > 0;
return HealthCheckResponse.builder()
.name("car-count-check")
.status(wellnessStatus) #1
.withData("cars-count", carsCount) #2
.build();
}
}
A custom wellness check implements `HealthCheck`, counts inventory records, and returns a named status plus the count as data. An empty inventory reports DOWN as a wellness concern rather than a reason to restart the pod. section 10.2.1 section 10.2








