Skip to content

Commit

Permalink
Merge branch '2.6.x' into 2.7.x
Browse files Browse the repository at this point in the history
Closes gh-31704
  • Loading branch information
snicoll committed Jul 13, 2022
2 parents 1664ce0 + 0ef213a commit b864755
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -139,7 +139,7 @@ public static class Logging {
/**
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public HealthEndpoint(HealthContributorRegistry registry, HealthEndpointGroups g
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -177,7 +177,7 @@ private T getLoggedHealth(C contributor, String name, boolean showDetails) {
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)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public HealthEndpointWebExtension(HealthContributorRegistry registry, HealthEndp
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public ReactiveHealthEndpointWebExtension(ReactiveHealthContributorRegistry regi
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,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.
Expand Down

0 comments on commit b864755

Please sign in to comment.