From 25520a9e32d57fc0c5e8cec01b832363e3b7d43c Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 13 Feb 2018 16:35:12 +0000 Subject: [PATCH] =?UTF-8?q?Polish=20=E2=80=9CAuto-configure=20FileDescript?= =?UTF-8?q?orMetrics=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes gh-12022 --- .../autoconfigure/metrics/MetricsAutoConfiguration.java | 2 +- .../additional-spring-configuration-metadata.json | 8 +++++++- .../metrics/MetricsAutoConfigurationTests.java | 9 ++++----- .../main/asciidoc/appendix-application-properties.adoc | 1 + 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfiguration.java index 2493e741c7..96eaf0a939 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfiguration.java @@ -128,7 +128,7 @@ public class MetricsAutoConfiguration { } @Bean - @ConditionalOnProperty(name = "management.metrics.binders.fds.enabled", matchIfMissing = true) + @ConditionalOnProperty(name = "management.metrics.binders.files.enabled", matchIfMissing = true) @ConditionalOnMissingBean public FileDescriptorMetrics fileDescriptorMetrics() { return new FileDescriptorMetrics(); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index d44005d147..9632126d2c 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -179,7 +179,13 @@ "name": "management.info.git.mode", "defaultValue": "simple" }, - { + { + "name": "management.metrics.binders.files.enabled", + "type": "java.lang.Boolean", + "description": "Whether to enable files metrics.", + "defaultValue": true + }, + { "name": "management.metrics.binders.integration.enabled", "type": "java.lang.Boolean", "description": "Whether to enable Spring Integration metrics.", diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfigurationTests.java index 4d886713fd..fcb05065bc 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfigurationTests.java @@ -213,20 +213,19 @@ public class MetricsAutoConfigurationTests { @Test public void autoConfiguresFileDescriptorMetrics() { - this.runner.run( - (context) -> assertThat(context) - .hasSingleBean(FileDescriptorMetrics.class)); + this.runner.run((context) -> assertThat(context) + .hasSingleBean(FileDescriptorMetrics.class)); } @Test public void allowsFileDescriptorMetricsToBeDisabled() { - this.runner.withPropertyValues("management.metrics.binders.fds.enabled=false") + this.runner.withPropertyValues("management.metrics.binders.files.enabled=false") .run((context) -> assertThat(context) .doesNotHaveBean(FileDescriptorMetrics.class)); } @Test - public void allowsCustomFileDescriptorToBeUsed() { + public void allowsCustomFileDescriptorMetricsToBeUsed() { this.runner.withUserConfiguration(CustomFileDescriptorMetricsConfiguration.class) .run((context) -> assertThat(context) .hasSingleBean(FileDescriptorMetrics.class) diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index 26543ff2cc..84e471527a 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -1295,6 +1295,7 @@ content into your application. Rather, pick only the properties that you need. management.info.git.mode=simple # Mode to use to expose git information. # METRICS + management.metrics.binders.files.enabled=true # Whether to enable files metrics. management.metrics.binders.integration.enabled=true # Whether to enable Spring Integration metrics. management.metrics.binders.jvm.enabled=true # Whether to enable JVM metrics. management.metrics.binders.logback.enabled=true # Whether to enable Logback metrics.