Skip to content

Polish gh-31231 #31540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -746,7 +746,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