Class HttpHealthCheck


  • public class HttpHealthCheck
    extends com.codahale.metrics.health.HealthCheck
    • Constructor Detail

      • HttpHealthCheck

        public HttpHealthCheck​(@NonNull String url)
      • HttpHealthCheck

        public HttpHealthCheck​(@NonNull String url,
                               Duration readTimeout,
                               Duration connectionTimeout)
      • HttpHealthCheck

        public HttpHealthCheck​(@NonNull String url,
                               @NonNull javax.ws.rs.client.Client client)
    • Method Detail

      • check

        protected com.codahale.metrics.health.HealthCheck.Result check()
        Specified by:
        check in class com.codahale.metrics.health.HealthCheck
      • httpCheck

        protected HttpHealthResponse httpCheck​(String url)
        Performs a health check via HTTP against an external dependency. By default uses the Jersey 2 HTTP client, but can be overridden to allow for different behavior.
        Parameters:
        url - the URL to check.
        Returns:
        response from the health check.
      • isHealthResponseValid

        protected boolean isHealthResponseValid​(HttpHealthResponse httpHealthResponse)
        Validates the response from the health check. By default checks if the response status is 2xx.
        Parameters:
        httpHealthResponse - The response resulting from the http health check.
        Returns:
        healthiness flag.