Managing Dropwizard health-checks

Daniel Skoczny
1 min readJul 16, 2018
http://www.dexlock.com/wp-content/uploads/2017/03/dropwizard.png

This light Java framework provides well-defined, built-in health-check feature, that allows check our application status. It is relatively easy to add self-defined health-checks to monitor particular module of our application.

Although usually we are more likely to add some new health-check to monitor additional component, sometimes there may be a strong reason to reduce them. Imagine a situation where you have custom database heath-check that is a bit more sophisticated than that built-in natively. Dropwizard automatically register a basic database health-check for each DBI within your application.

{“database”:{“healthy”:true},”db1":{“healthy”:true},”db2":{“healthy”:true}}

In our case, as we have custom implementation of this check, we don’t need to duplicate it. Fortunately, there is an easy way to disable the native one:

environment.healthChecks().unregister(“db1”);
environment.healthChecks().unregister(“db2”);

Doing so, our service validation will look like that:

{“database”:{“healthy”:true}}

Just make sure the database check is at least as good as default db1 and db2.

More information about health-checks here:
https://metrics.dropwizard.io/3.1.0/manual/healthchecks/

--

--

Daniel Skoczny

DevOps. AWS and cloud computing passionate. Always can’t wait for new JDK release. DevOps approach proponent. Believes that everything can be automated.