@Singleton @Requires(beans=HealthEndpoint.class) public class RxJavaHealthAggregator 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
of the details of the top level object.
Example: [status: "UP, details: [diskSpace: [status: UP, details: [:]], cpuUsage: ...]]
Constructor and Description |
---|
RxJavaHealthAggregator(ApplicationConfiguration applicationConfiguration)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
Publisher<HealthResult> |
aggregate(HealthIndicator[] indicators,
HealthLevelOfDetail healthLevelOfDetail) |
Publisher<HealthResult> |
aggregate(String name,
Publisher<HealthResult> results) |
protected Object |
aggregateDetails(List<HealthResult> results) |
protected io.reactivex.Flowable<HealthResult> |
aggregateResults(HealthIndicator[] indicators) |
protected HealthResult |
buildResult(HealthStatus status,
Object details,
HealthLevelOfDetail healthLevelOfDetail) |
protected HealthStatus |
calculateOverallStatus(List<HealthResult> results) |
public RxJavaHealthAggregator(ApplicationConfiguration applicationConfiguration)
applicationConfiguration
- The application configuration.public Publisher<HealthResult> aggregate(HealthIndicator[] indicators, HealthLevelOfDetail healthLevelOfDetail)
aggregate
in interface HealthAggregator<HealthResult>
indicators
- The health indicators to aggregate.healthLevelOfDetail
- The HealthLevelOfDetail
public Publisher<HealthResult> aggregate(String name, Publisher<HealthResult> results)
aggregate
in interface HealthAggregator<HealthResult>
name
- The name of the new health resultresults
- The health results to aggregate.HealthResult
.protected HealthStatus calculateOverallStatus(List<HealthResult> results)
results
- A list of HealthResult
protected io.reactivex.Flowable<HealthResult> aggregateResults(HealthIndicator[] indicators)
indicators
- An array of HealthIndicator
protected Object aggregateDetails(List<HealthResult> results)
results
- A list of health resultsprotected HealthResult buildResult(HealthStatus status, Object details, HealthLevelOfDetail healthLevelOfDetail)
status
- A HealthStatus
details
- The health status detailshealthLevelOfDetail
- The HealthLevelOfDetail
Map
with the results from the health status