Class DefaultHealthAggregator

  • All Implemented Interfaces:
    HealthAggregator<HealthResult>

    @Singleton
    @Requires(beans=HealthEndpoint.class)
    public class DefaultHealthAggregator
    extends java.lang.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: ...]]

    Since:
    1.0
    • Constructor Detail

      • DefaultHealthAggregator

        public DefaultHealthAggregator​(io.micronaut.runtime.ApplicationConfiguration applicationConfiguration)
        Default constructor.
        Parameters:
        applicationConfiguration - The application configuration.
    • Method Detail

      • calculateOverallStatus

        protected io.micronaut.health.HealthStatus calculateOverallStatus​(java.util.List<HealthResult> results)
        Parameters:
        results - A list of HealthResult
        Returns:
        The calculated overall health status
      • aggregateResults

        protected reactor.core.publisher.Flux<HealthResult> aggregateResults​(HealthIndicator[] indicators)
        Parameters:
        indicators - An array of HealthIndicator
        Returns:
        The aggregated results from all health indicators
      • aggregateDetails

        protected java.lang.Object aggregateDetails​(java.util.List<HealthResult> results)
        Parameters:
        results - A list of health results
        Returns:
        The aggregated details for the results
      • buildResult

        protected HealthResult buildResult​(io.micronaut.health.HealthStatus status,
                                           java.lang.Object details,
                                           HealthLevelOfDetail healthLevelOfDetail)
        Parameters:
        status - A HealthStatus
        details - The health status details
        healthLevelOfDetail - The HealthLevelOfDetail
        Returns:
        A Map with the results from the health status