Package io.dropwizard.health.check.http
Class HttpHealthCheck
- java.lang.Object
-
- com.codahale.metrics.health.HealthCheck
-
- io.dropwizard.health.check.http.HttpHealthCheck
-
public class HttpHealthCheck extends com.codahale.metrics.health.HealthCheck
-
-
Constructor Summary
Constructors Constructor Description HttpHealthCheck(@NonNull String url)HttpHealthCheck(@NonNull String url, @NonNull javax.ws.rs.client.Client client)HttpHealthCheck(@NonNull String url, Duration readTimeout, Duration connectionTimeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.codahale.metrics.health.HealthCheck.Resultcheck()protected HttpHealthResponsehttpCheck(String url)Performs a health check via HTTP against an external dependency.protected booleanisHealthResponseValid(HttpHealthResponse httpHealthResponse)Validates the response from the health check.
-
-
-
Method Detail
-
check
protected com.codahale.metrics.health.HealthCheck.Result check()
- Specified by:
checkin classcom.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.
-
-