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 jakarta.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.Result
check()
protected HttpHealthResponse
httpCheck(String url)
Performs a health check via HTTP against an external dependency.protected boolean
isHealthResponseValid(HttpHealthResponse httpHealthResponse)
Validates the response from the health check.
-
-
-
Method Detail
-
check
protected com.codahale.metrics.health.HealthCheck.Result check()
- Specified by:
check
in 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.
-
-