Class DefaultHealthAggregator
java.lang.Object
io.micronaut.management.health.aggregator.DefaultHealthAggregator
- All Implemented Interfaces:
HealthAggregator<HealthResult>
@Singleton
@Requires(beans=HealthEndpoint.class)
public class DefaultHealthAggregator
extends Object
implements HealthAggregator<HealthResult>
Default implementation of HealthAggregator that creates a {status: , description: (optional) , details: }
response. The top level object represents the most severe status found in the provided health results, or
HealthStatus.UNKNOWN if none found. All registered indicators have their own
{status: , description: (optional) , details: } object, keyed by the name of the HealthResult defined inside
the details of the top level object.
Example: [status: "UP, details: [diskSpace: [status: UP, details: [:]], cpuUsage: ...]]
- Since:
- 1.0
- Author:
- James Kleeh, Graeme Rocher
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultHealthAggregator(ApplicationConfiguration applicationConfiguration) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionaggregate(HealthIndicator[] indicators, HealthLevelOfDetail healthLevelOfDetail) aggregate(String name, Publisher<HealthResult> results) protected ObjectaggregateDetails(List<HealthResult> results) protected reactor.core.publisher.Flux<HealthResult>aggregateResults(HealthIndicator[] indicators) protected HealthResultbuildResult(HealthStatus status, Object details, HealthLevelOfDetail healthLevelOfDetail) protected HealthStatuscalculateOverallStatus(List<HealthResult> results)
-
Constructor Details
-
DefaultHealthAggregator
Default constructor.- Parameters:
applicationConfiguration- The application configuration.
-
-
Method Details
-
aggregate
public Publisher<HealthResult> aggregate(HealthIndicator[] indicators, HealthLevelOfDetail healthLevelOfDetail) - Specified by:
aggregatein interfaceHealthAggregator<HealthResult>- Parameters:
indicators- The health indicators to aggregate.healthLevelOfDetail- TheHealthLevelOfDetail- Returns:
- An aggregated response.
-
aggregate
- Specified by:
aggregatein interfaceHealthAggregator<HealthResult>- Parameters:
name- The name of the new health resultresults- The health results to aggregate.- Returns:
- An aggregated
HealthResult.
-
calculateOverallStatus
- Parameters:
results- A list ofHealthResult- Returns:
- The calculated overall health status
-
aggregateResults
- Parameters:
indicators- An array ofHealthIndicator- Returns:
- The aggregated results from all health indicators
-
aggregateDetails
- Parameters:
results- A list of health results- Returns:
- The aggregated details for the results
-
buildResult
protected HealthResult buildResult(HealthStatus status, Object details, HealthLevelOfDetail healthLevelOfDetail) - Parameters:
status- AHealthStatusdetails- The health status detailshealthLevelOfDetail- TheHealthLevelOfDetail- Returns:
- A
Mapwith the results from the health status
-