diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterAutoConfiguration.java index 372fef1a36..236b70edd0 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterAutoConfiguration.java @@ -48,7 +48,7 @@ import org.springframework.web.servlet.HandlerMapping; @ConditionalOnClass({ Servlet.class, ServletRegistration.class, OncePerRequestFilter.class, HandlerMapping.class }) @AutoConfigureAfter(MetricRepositoryAutoConfiguration.class) -@ConditionalOnProperty(prefix = "endpoints.metrics.filter", name = "enabled", matchIfMissing = true) +@ConditionalOnProperty(prefix = "management.metrics.filter", name = "enabled", matchIfMissing = true) @EnableConfigurationProperties({ MetricFilterProperties.class }) public class MetricFilterAutoConfiguration { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterProperties.java index 767cfa8b08..ad9244c75c 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterProperties.java @@ -31,7 +31,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * @author Phillip Webb * @since 2.0.0 */ -@ConfigurationProperties(prefix = "endpoints.metrics.filter") +@ConfigurationProperties(prefix = "management.metrics.filter") public class MetricFilterProperties { /** diff --git a/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 2c485572b5..e71808c2ea 100644 --- a/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -45,11 +45,32 @@ "vcap_services" ] }, + { + "name": "endpoints.metrics.filter.counter-submissions", + "type": "java.util.Set", + "description": "Submissions that should be made to the counter.", + "deprecation": { + "replacement": "management.metrics.filter.counter-submissions", + "level": "error" + } + }, { "name": "endpoints.metrics.filter.enabled", "type": "java.lang.Boolean", "description": "Enable the metrics servlet filter.", - "defaultValue": true + "deprecation": { + "replacement": "management.metrics.filter.enabled", + "level": "error" + } + }, + { + "name": "endpoints.metrics.filter.gauge-submissions", + "type": "java.util.Set", + "description": "Submissions that should be made to the gauge.", + "deprecation": { + "replacement": "management.metrics.filter.gauge-submissions", + "level": "error" + } }, { "name": "endpoints.trace.filter.enabled", @@ -186,6 +207,12 @@ "name": "management.info.git.mode", "defaultValue": "simple" }, + { + "name": "management.metrics.filter.enabled", + "type": "java.lang.Boolean", + "description": "Enable the metrics servlet filter.", + "defaultValue": true + }, { "name": "management.security.sessions", "defaultValue": "stateless" diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterAutoConfigurationTests.java index 177162f837..cde84471dd 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterAutoConfigurationTests.java @@ -236,7 +236,7 @@ public class MetricFilterAutoConfigurationTests { @Test public void skipsFilterIfPropertyDisabled() throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of("endpoints.metrics.filter.enabled:false").applyTo(context); + TestPropertyValues.of("management.metrics.filter.enabled:false").applyTo(context); context.register(Config.class, MetricFilterAutoConfiguration.class); context.refresh(); assertThat(context.getBeansOfType(Filter.class).size()).isEqualTo(0); @@ -357,8 +357,8 @@ public class MetricFilterAutoConfigurationTests { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(Config.class, MetricFilterAutoConfiguration.class); TestPropertyValues - .of("endpoints.metrics.filter.gauge-submissions=merged,per-http-method", - "endpoints.metrics.filter.counter-submissions=merged,per-http-method") + .of("management.metrics.filter.gauge-submissions=merged,per-http-method", + "management.metrics.filter.counter-submissions=merged,per-http-method") .applyTo(context); context.refresh(); Filter filter = context.getBean(Filter.class); @@ -385,8 +385,8 @@ public class MetricFilterAutoConfigurationTests { public void doesNotRecordRolledUpMetricsIfConfigured() throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(Config.class, MetricFilterAutoConfiguration.class); - TestPropertyValues.of("endpoints.metrics.filter.gauge-submissions=", - "endpoints.metrics.filter.counter-submissions=").applyTo(context); + TestPropertyValues.of("management.metrics.filter.gauge-submissions=", + "management.metrics.filter.counter-submissions=").applyTo(context); context.refresh(); Filter filter = context.getBean(Filter.class); MockHttpServletRequest request = new MockHttpServletRequest("PUT", "/test/path"); diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index 8adb05ee0f..8b065df5c2 100644 --- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -1173,9 +1173,6 @@ content into your application; rather pick only the properties that you need. endpoints.metrics.enabled=true # Enable the metrics endpoint. endpoints.metrics.jmx.enabled=true # Expose the metrics endpoint as a JMX MBean. endpoints.metrics.web.enabled=false # Expose the metrics endpoint as a Web endpoint. - endpoints.metrics.filter.counter-submissions= # Submissions that should be made to the counter. - endpoints.metrics.filter.enabled=true # Enable the metrics servlet filter. - endpoints.metrics.filter.gauge-submissions= # Submissions that should be made to the gauge. # SHUTDOWN ENDPOINT ({sc-spring-boot-actuator}/endpoint/ShutdownEndpoint.{sc-ext}[ShutdownEndpoint]) endpoints.shutdown.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached. @@ -1277,6 +1274,11 @@ content into your application; rather pick only the properties that you need. management.jolokia.enabled=false # Enable Jolokia. management.jolokia.path=/jolokia # Path at which Jolokia will be available. + # METRICS FILTER ({sc-spring-boot-actuator}/autoconfigure/metrics/MetricsFilterProperties.{sc-ext}[MetricsFilterProperties]) + management.metrics.filter.counter-submissions= # Submissions that should be made to the counter. + management.metrics.filter.enabled=true # Enable the metrics servlet filter. + management.metrics.filter.gauge-submissions= # Submissions that should be made to the gauge. + # TRACING ({sc-spring-boot-actuator}/trace/TraceProperties.{sc-ext}[TraceProperties]) management.trace.include=request-headers,response-headers,cookies,errors # Items to be included in the trace.