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
-
Nested Class Summary
Nested classes/interfaces inherited from class com.codahale.metrics.health.HealthCheck
com.codahale.metrics.health.HealthCheck.Result, com.codahale.metrics.health.HealthCheck.ResultBuilder -
Constructor Summary
ConstructorsConstructorDescriptionHttpHealthCheck(@NonNull String url) HttpHealthCheck(@NonNull String url, @NonNull jakarta.ws.rs.client.Client client) HttpHealthCheck(@NonNull String url, Duration readTimeout, Duration connectionTimeout) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.codahale.metrics.health.HealthCheck.Resultcheck()protected HttpHealthResponsePerforms a health check via HTTP against an external dependency.protected booleanisHealthResponseValid(HttpHealthResponse httpHealthResponse) Validates the response from the health check.Methods inherited from class com.codahale.metrics.health.HealthCheck
clock, execute
-
Constructor Details
-
HttpHealthCheck
-
HttpHealthCheck
-
HttpHealthCheck
-
-
Method Details
-
check
protected com.codahale.metrics.health.HealthCheck.Result check()- Specified by:
checkin classcom.codahale.metrics.health.HealthCheck
-
httpCheck
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
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.
-