-
Notifications
You must be signed in to change notification settings - Fork 4
Health Checks
The core module contains a few classes and interfaces to facilitate building health checks. Note that the core system does not bind you to any particular health and metrics platform. At HomeAdvisor we used Codahale metrics, but the framework is generic enough to let you use any provider you want.
This interface represents a single health check within the client. A single client may implement multiple checks. It has a single method, doCheck, that returns a HealthCheckResult.
The class represents the result of a single health check. It contains 2 fields:
- Status: An enum of possible results (HEALTY, IMPAIRED, UNHEALTHY, UNKNOWN).
- String: A message to provide context about the Status.
This interface should be used for any client that wishes to expose health checks. It uses Java 8 default methods to provide some basic functionality, such as rolling up the results of multiple _HealthCheck_s into a single result.
This is an implementation of HealthCheck that uses Hystrix failures to determine client health. It relies on HystrixCommandMetrics for a given command name, and by default will report UNHEALTY if there has been at least 1 failure in the last N seconds, where N is defined by metricsRollingStatisticalWindowInMilliseconds.
Neither AbstractApiClient or SpringRestClient create health checks by default. At HomeAdvisor, we have a custom extension of SpringRestClient that uses Codahale MetricsRegistry to create a number of health checks for both Hystrix and Curator, and the expose them into our reporting framework.
HomeAdvisor is the leading marketplace for home owners and service professionals to connect.