Add probe method to DiscoveryClient (#789)
Add probe method to DiscoveryClient and optionally use in DiscoveryClientHealthIndicator. Fixes gh-785 Co-authored-by: Spencer Gibb <sgibb@pivotal.io>
This commit is contained in:
@@ -10,6 +10,10 @@
|
||||
|spring.cloud.discovery.client.health-indicator.enabled | true |
|
||||
|spring.cloud.discovery.client.health-indicator.include-description | false |
|
||||
|spring.cloud.discovery.client.simple.instances | |
|
||||
|spring.cloud.discovery.client.simple.local.instance-id | | The unique identifier or name for the service instance.
|
||||
|spring.cloud.discovery.client.simple.local.metadata | | Metadata for the service instance. Can be used by discovery clients to modify their behaviour per instance, e.g. when load balancing.
|
||||
|spring.cloud.discovery.client.simple.local.service-id | | The identifier or name for the service. Multiple instances might share the same service ID.
|
||||
|spring.cloud.discovery.client.simple.local.uri | | The URI of the service instance. Will be parsed to extract the scheme, host, and port.
|
||||
|spring.cloud.discovery.client.simple.order | |
|
||||
|spring.cloud.discovery.enabled | true | Enables discovery client health indicators.
|
||||
|spring.cloud.features.enabled | true | Enables the features endpoint.
|
||||
|
||||
@@ -258,14 +258,23 @@ This behavior can be disabled by setting `autoRegister=false` in `@EnableDiscove
|
||||
NOTE: `@EnableDiscoveryClient` is no longer required.
|
||||
You can put a `DiscoveryClient` implementation on the classpath to cause the Spring Boot application to register with the service discovery server.
|
||||
|
||||
==== Health Indicator
|
||||
==== Health Indicators
|
||||
|
||||
Commons creates a Spring Boot `HealthIndicator` that `DiscoveryClient` implementations can participate in by implementing `DiscoveryHealthIndicator`.
|
||||
To disable the composite `HealthIndicator`, set `spring.cloud.discovery.client.composite-indicator.enabled=false`.
|
||||
A generic `HealthIndicator` based on `DiscoveryClient` is auto-configured (`DiscoveryClientHealthIndicator`).
|
||||
To disable it, set `spring.cloud.discovery.client.health-indicator.enabled=false`.
|
||||
To disable the description field of the `DiscoveryClientHealthIndicator`, set `spring.cloud.discovery.client.health-indicator.include-description=false`.
|
||||
Commons auto-configures the following Spring Boot health indicators.
|
||||
|
||||
===== DiscoveryClientHealthIndicator
|
||||
This health indicator is based on the currently registered `DiscoveryClient` implementation.
|
||||
|
||||
* To disable entirely, set `spring.cloud.discovery.client.health-indicator.enabled=false`.
|
||||
* To disable the description field, set `spring.cloud.discovery.client.health-indicator.include-description=false`.
|
||||
Otherwise, it can bubble up as the `description` of the rolled up `HealthIndicator`.
|
||||
* To disable service retrieval, set `spring.cloud.discovery.client.health-indicator.use-services-query=false`.
|
||||
By default, the indicator invokes the client's `getServices` method. In deployments with many registered services it may too
|
||||
costly to retrieve all services during every check. This will skip the service retrieval and instead use the client's `probe` method.
|
||||
|
||||
===== DiscoveryCompositeHealthContributor
|
||||
This composite health indicator is based on all registered `DiscoveryHealthIndicator` beans. To disable,
|
||||
set `spring.cloud.discovery.client.composite-indicator.enabled=false`.
|
||||
|
||||
==== Ordering `DiscoveryClient` instances
|
||||
`DiscoveryClient` interface extends `Ordered`. This is useful when using multiple discovery
|
||||
|
||||
Reference in New Issue
Block a user