Add support for ReactiveHealthIndicatorRegistry

This commit updates the initial proposal to add support for reactive
use cases as well. A reactive application can use
ReactiveHealthIndicatorRegistry as an alternative to
HealthIndicatorRegistry.

Closes gh-4965
This commit is contained in:
Stephane Nicoll
2018-05-16 16:15:45 +02:00
parent 95b251590e
commit 2c176a3770
16 changed files with 589 additions and 146 deletions

View File

@@ -725,16 +725,20 @@ NOTE: If you have secured your application and wish to use `always`, your securi
configuration must permit access to the health endpoint for both authenticated and
unauthenticated users.
Health information is collected from all
Health information is collected from the content of a
{sc-spring-boot-actuator}/health/HealthIndicatorRegistry.{sc-ext}[
`HealthIndicatorRegistry`] (by default all
{sc-spring-boot-actuator}/health/HealthIndicator.{sc-ext}[`HealthIndicator`] instances
registered with {sc-spring-boot-actuator}/health/HealthIndicatorRegistry.{sc-ext}[
`HealthIndicatorRegistry`]. Spring Boot includes a number of auto-configured
defined in your `ApplicationContext`. Spring Boot includes a number of auto-configured
`HealthIndicators` and you can also write your own. By default, the final system state is
derived by the `HealthAggregator` which sorts the statuses from each `HealthIndicator`
based on an ordered list of statuses. The first status in the sorted list is used as the
overall health status. If no `HealthIndicator` returns a status that is known to the
`HealthAggregator`, an `UNKNOWN` status is used.
TIP: The `HealthIndicatorRegistry` can be used to register and unregister health
indicators at runtime.
==== Auto-configured HealthIndicators
@@ -819,10 +823,6 @@ NOTE: The identifier for a given `HealthIndicator` is the name of the bean witho
`HealthIndicator` suffix, if it exists. In the preceding example, the health information
is available in an entry named `my`.
Additionally, you can register (and unregister) `HealthIndicator` instances in runtime
using {sc-spring-boot-actuator}/health/HealthIndicatorRegistry.{sc-ext}[
`HealthIndicatorRegistry`].
In addition to Spring Boot's predefined
{sc-spring-boot-actuator}/health/Status.{sc-ext}[`Status`] types, it is also possible for
`Health` to return a custom `Status` that represents a new system state. In such cases, a
@@ -877,10 +877,17 @@ The following table shows the default status mappings for the built-in statuses:
==== Reactive Health Indicators
For reactive applications, such as those using Spring WebFlux, `ReactiveHealthIndicator`
provides a non-blocking contract for getting application health. Similar to a traditional
`HealthIndicator`, health information is collected from all
{sc-spring-boot-actuator}/health/ReactiveHealthIndicator.{sc-ext}[`ReactiveHealthIndicator`]
beans defined in your `ApplicationContext`. Regular `HealthIndicator` beans that do not
check against a reactive API are included and executed on the elastic scheduler.
`HealthIndicator`, health information is collected from the content of a
{sc-spring-boot-actuator}/health/ReactiveHealthIndicatorRegistry.{sc-ext}[
`ReactiveHealthIndicatorRegistry`] (by default all
{sc-spring-boot-actuator}/health/HealthIndicator.{sc-ext}[`HealthIndicator`] and
{sc-spring-boot-actuator}/health/ReactiveHealthIndicator.{sc-ext}[
`ReactiveHealthIndicator`] instances defined in your `ApplicationContext`. Regular
`HealthIndicator` that do not check against a reactive API are executed on the elastic
scheduler.
TIP: In a reactive application, The `ReactiveHealthIndicatorRegistry` can be used to
register and unregister health indicators at runtime.
To provide custom health information from a reactive API, you can register Spring beans
that implement the