Browse Source

Merge branch '2.7.x'

Closes gh-31705
pull/31712/head
Stephane Nicoll 4 years ago
parent
commit
9cace34a19
  1. 6
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointProperties.java
  2. 1
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpoint.java
  3. 4
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpointSupport.java
  4. 1
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpointWebExtension.java
  5. 1
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthEndpointWebExtension.java
  6. 2
      spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/endpoints.adoc

6
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointProperties.java

@ -42,9 +42,9 @@ public class HealthEndpointProperties extends HealthProperties { @@ -42,9 +42,9 @@ public class HealthEndpointProperties extends HealthProperties {
/**
* 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
public Show getShowDetails() {
@ -139,7 +139,7 @@ public class HealthEndpointProperties extends HealthProperties { @@ -139,7 +139,7 @@ public class HealthEndpointProperties extends HealthProperties {
/**
* 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() {
return this.slowIndicatorThreshold;

1
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpoint.java

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

4
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpointSupport.java

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

1
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpointWebExtension.java

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

1
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthEndpointWebExtension.java

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

2
spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/endpoints.adoc

@ -738,7 +738,7 @@ In the preceding example, the health information is available in an entry named @@ -738,7 +738,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.
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 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