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
ConstructorDescriptionDefaultHealthAggregator
(ApplicationConfiguration applicationConfiguration) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionaggregate
(HealthIndicator[] indicators, HealthLevelOfDetail healthLevelOfDetail) aggregate
(String name, Publisher<HealthResult> results) protected Object
aggregateDetails
(List<HealthResult> results) protected reactor.core.publisher.Flux<HealthResult>
aggregateResults
(HealthIndicator[] indicators) protected HealthResult
buildResult
(HealthStatus status, Object details, HealthLevelOfDetail healthLevelOfDetail) protected HealthStatus
calculateOverallStatus
(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:
aggregate
in interfaceHealthAggregator<HealthResult>
- Parameters:
indicators
- The health indicators to aggregate.healthLevelOfDetail
- TheHealthLevelOfDetail
- Returns:
- An aggregated response.
-
aggregate
- Specified by:
aggregate
in 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
- AHealthStatus
details
- The health status detailshealthLevelOfDetail
- TheHealthLevelOfDetail
- Returns:
- A
Map
with the results from the health status
-