Skip to content

Health check installer

CoreInstallersBundle / HealthCheckInstaller

Installs dropwizard health check.

Recognition

Detects classes extending guicey NamedHealthCheck and register their instances in environment. Custom base class is required, because default HealthCheck did not provide check name, which is required for registration.

public class MyHealthCheck extends NamedHealthCheck {

    @Inject
    private MyService service;

    @Override
    protected Result check() throws Exception {
        if (service.isOk()) {
            return Result.healthy();
        } else {
            return Result.unhealthy("Service is not ok");
        }
    }

    @Override
    public String getName() {
        return "my-service";
    }
}
Back to top