Merge pull request #31540 from izeye

* pr/31540:
  Polish gh-31231

Closes gh-31540
pull/32521/head
Stephane Nicoll 2 years ago
commit 0ef213a38d

@ -42,9 +42,9 @@ public class HealthEndpointProperties extends HealthProperties {
/** /**
* Health endpoint groups. * Health endpoint groups.
*/ */
private Map<String, Group> group = new LinkedHashMap<>(); private final Map<String, Group> group = new LinkedHashMap<>();
private Logging logging = new Logging(); private final Logging logging = new Logging();
@Override @Override
public Show getShowDetails() { public Show getShowDetails() {
@ -139,7 +139,7 @@ public class HealthEndpointProperties extends HealthProperties {
/** /**
* Threshold after which a warning will be logged for slow health indicators. * Threshold after which a warning will be logged for slow health indicators.
*/ */
Duration slowIndicatorThreshold = Duration.ofSeconds(10); private Duration slowIndicatorThreshold = Duration.ofSeconds(10);
public Duration getSlowIndicatorThreshold() { public Duration getSlowIndicatorThreshold() {
return this.slowIndicatorThreshold; return this.slowIndicatorThreshold;

@ -66,6 +66,7 @@ public class HealthEndpoint extends HealthEndpointSupport<HealthContributor, Hea
* @param groups the health endpoint groups * @param groups the health endpoint groups
* @param slowIndicatorLoggingThreshold duration after which slow health indicator * @param slowIndicatorLoggingThreshold duration after which slow health indicator
* logging should occur * logging should occur
* @since 2.6.9
*/ */
public HealthEndpoint(HealthContributorRegistry registry, HealthEndpointGroups groups, public HealthEndpoint(HealthContributorRegistry registry, HealthEndpointGroups groups,
Duration slowIndicatorLoggingThreshold) { Duration slowIndicatorLoggingThreshold) {

@ -52,7 +52,7 @@ abstract class HealthEndpointSupport<C, T> {
private final HealthEndpointGroups groups; private final HealthEndpointGroups groups;
private Duration slowIndicatorLoggingThreshold; private final Duration slowIndicatorLoggingThreshold;
/** /**
* Create a new {@link HealthEndpointSupport} instance. * Create a new {@link HealthEndpointSupport} instance.
@ -177,7 +177,7 @@ abstract class HealthEndpointSupport<C, T> {
if (duration.compareTo(this.slowIndicatorLoggingThreshold) > 0) { if (duration.compareTo(this.slowIndicatorLoggingThreshold) > 0) {
String contributorClassName = contributor.getClass().getName(); String contributorClassName = contributor.getClass().getName();
Object contributorIdentifier = (!StringUtils.hasLength(name)) ? contributorClassName Object contributorIdentifier = (!StringUtils.hasLength(name)) ? contributorClassName
: contributor.getClass().getName() + " (" + name + ")"; : contributorClassName + " (" + name + ")";
logger.warn(LogMessage.format("Health contributor %s took %s to respond", contributorIdentifier, logger.warn(LogMessage.format("Health contributor %s took %s to respond", contributorIdentifier,
DurationStyle.SIMPLE.print(duration))); DurationStyle.SIMPLE.print(duration)));
} }

@ -66,6 +66,7 @@ public class HealthEndpointWebExtension extends HealthEndpointSupport<HealthCont
* @param groups the health endpoint groups * @param groups the health endpoint groups
* @param slowIndicatorLoggingThreshold duration after which slow health indicator * @param slowIndicatorLoggingThreshold duration after which slow health indicator
* logging should occur * logging should occur
* @since 2.6.9
*/ */
public HealthEndpointWebExtension(HealthContributorRegistry registry, HealthEndpointGroups groups, public HealthEndpointWebExtension(HealthContributorRegistry registry, HealthEndpointGroups groups,
Duration slowIndicatorLoggingThreshold) { Duration slowIndicatorLoggingThreshold) {

@ -66,6 +66,7 @@ public class ReactiveHealthEndpointWebExtension
* @param groups the health endpoint groups * @param groups the health endpoint groups
* @param slowIndicatorLoggingThreshold duration after which slow health indicator * @param slowIndicatorLoggingThreshold duration after which slow health indicator
* logging should occur * logging should occur
* @since 2.6.9
*/ */
public ReactiveHealthEndpointWebExtension(ReactiveHealthContributorRegistry registry, HealthEndpointGroups groups, public ReactiveHealthEndpointWebExtension(ReactiveHealthContributorRegistry registry, HealthEndpointGroups groups,
Duration slowIndicatorLoggingThreshold) { Duration slowIndicatorLoggingThreshold) {

@ -769,7 +769,7 @@ In the preceding example, the health information is available in an entry named
TIP: Health indicators are usually called over HTTP and need to respond before any connection timeouts. TIP: Health indicators are usually called over HTTP and need to respond before any connection timeouts.
Spring Boot will log a warning message for any health indicator that takes longer than 10 seconds to respond. Spring Boot will log a warning message for any health indicator that takes longer than 10 seconds to respond.
If you want to configure this threshold, you can use the configprop:management.endpoint.health.logging.slow-indicator-threshold[] property If you want to configure this threshold, you can use the configprop:management.endpoint.health.logging.slow-indicator-threshold[] property.
In addition to Spring Boot's predefined {spring-boot-actuator-module-code}/health/Status.java[`Status`] types, `Health` can return a custom `Status` that represents a new system state. In addition to Spring Boot's predefined {spring-boot-actuator-module-code}/health/Status.java[`Status`] types, `Health` can return a custom `Status` that represents a new system state.
In such cases, you also need to provide a custom implementation of the {spring-boot-actuator-module-code}/health/StatusAggregator.java[`StatusAggregator`] interface, or you must configure the default implementation by using the configprop:management.endpoint.health.status.order[] configuration property. In such cases, you also need to provide a custom implementation of the {spring-boot-actuator-module-code}/health/StatusAggregator.java[`StatusAggregator`] interface, or you must configure the default implementation by using the configprop:management.endpoint.health.status.order[] configuration property.

Loading…
Cancel
Save