@Endpoint(value="health", defaultSensitive=false) public class HealthEndpoint extends Object
Exposes an Endpoint
to provide information about the health of the application.
Modifier and Type | Class and Description |
---|---|
static class |
HealthEndpoint.StatusConfiguration
Configuration related to handling of the
HealthStatus . |
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_SENSITIVE
If the endpoint is sensitive if no configuration is provided.
|
static String |
NAME
Constant for health.
|
static String |
PREFIX
Prefix for health endpoint.
|
Constructor and Description |
---|
HealthEndpoint(HealthAggregator<HealthResult> healthAggregator,
HealthIndicator[] healthIndicators,
HealthIndicator[] livenessHealthIndicators) |
Modifier and Type | Method and Description |
---|---|
DetailsVisibility |
getDetailsVisible() |
Publisher<HealthResult> |
getHealth(Principal principal)
Return all health indicators.
|
Publisher<HealthResult> |
getHealth(Principal principal,
HealthCheckType selector)
Return health indicators based on the selector.
|
protected HealthIndicator[] |
getReadinessHealthIndicators(HealthIndicator[] allHealthIndicators,
HealthIndicator[] livenessHealthIndicators) |
HealthEndpoint.StatusConfiguration |
getStatusConfiguration() |
boolean |
isServiceReadyIndicatorEnabled()
Whether the
ServiceReadyHealthIndicator is enabled. |
protected HealthLevelOfDetail |
levelOfDetail(Principal principal)
Returns the level of detail that should be returned by the endpoint.
|
void |
setDetailsVisible(DetailsVisibility detailsVisible)
Sets the visibility policy for health information.
|
void |
setServiceReadyIndicatorEnabled(boolean serviceReadyIndicatorEnabled)
Set whether the
ServiceReadyHealthIndicator is enabled. |
void |
setStatusConfiguration(HealthEndpoint.StatusConfiguration statusConfiguration)
Sets the status configuration.
|
public static final boolean DEFAULT_SENSITIVE
public static final String NAME
public static final String PREFIX
public HealthEndpoint(HealthAggregator<HealthResult> healthAggregator, HealthIndicator[] healthIndicators, @Liveness HealthIndicator[] livenessHealthIndicators)
healthAggregator
- The HealthAggregator
healthIndicators
- The HealthIndicator
livenessHealthIndicators
- The HealthIndicator
qualified by Liveness
protected final HealthIndicator[] getReadinessHealthIndicators(HealthIndicator[] allHealthIndicators, HealthIndicator[] livenessHealthIndicators)
@Read @SingleResult public Publisher<HealthResult> getHealth(@Nullable Principal principal)
principal
- Authenticated userMono
@Read @SingleResult public Publisher<HealthResult> getHealth(@Nullable Principal principal, @Selector HealthCheckType selector)
principal
- Authenticated userselector
- HealthEndpointSelectorMono
public boolean isServiceReadyIndicatorEnabled()
ServiceReadyHealthIndicator
is enabled. Defaults to true
.public void setServiceReadyIndicatorEnabled(boolean serviceReadyIndicatorEnabled)
ServiceReadyHealthIndicator
is enabled. Defaults to true
.serviceReadyIndicatorEnabled
- True if the service ready indicator should be enabled.public DetailsVisibility getDetailsVisible()
public void setDetailsVisible(DetailsVisibility detailsVisible)
detailsVisible
- The DetailsVisibility
public HealthEndpoint.StatusConfiguration getStatusConfiguration()
@Inject public void setStatusConfiguration(HealthEndpoint.StatusConfiguration statusConfiguration)
statusConfiguration
- The status configurationprotected HealthLevelOfDetail levelOfDetail(@Nullable Principal principal)
principal
- Authenticated userHealthLevelOfDetail