Skip to content

Dropwizard HealthChecks

Brett Wooldridge edited this page Jan 30, 2015 · 12 revisions

HikariCP 2.3.2+ supports Dropwizard HealthChecks.

You can enable health checks by configuring a HealthCheckRegistry instance in HikariConfig or HikariDataSource (depending on which you use for configuration). There is a method, setHealthCheckRegistry(HealthCheckRegistry), for this purpose.

HikariCP also supports additional health check specific configuration through the addHealthCheckProperty(key, value) and/or setHealthCheckProperties(Properties) methods. The properties specific to each health check is documented below.

<pool name>.pool.ConnectivityCheck

This health check will obtain a Connection from the pool and immediately return it. The standard HikariCP internal "aliveness" check will be run.

By default this health check will use the standard pool connectionTimeout when obtaining a Connection. However, if the connectionTimeout is disabled (set to 0) then a timeout of 10 seconds will be used.

A specific timeout can also be set through a health check property called connectivityCheckTimeoutMs:

config.addHealthCheckProperty("connectivityCheckTimeoutMs", "1000");
<pool name>.pool.Connection99Percent (optional)