Move endpoints.metrics.filter to management.metrics.filter

See gh-10007
pull/10107/head
Stephane Nicoll 7 years ago
parent 4c7088981f
commit 54781c73b5

@ -48,7 +48,7 @@ import org.springframework.web.servlet.HandlerMapping;
@ConditionalOnClass({ Servlet.class, ServletRegistration.class, @ConditionalOnClass({ Servlet.class, ServletRegistration.class,
OncePerRequestFilter.class, HandlerMapping.class }) OncePerRequestFilter.class, HandlerMapping.class })
@AutoConfigureAfter(MetricRepositoryAutoConfiguration.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 }) @EnableConfigurationProperties({ MetricFilterProperties.class })
public class MetricFilterAutoConfiguration { public class MetricFilterAutoConfiguration {

@ -31,7 +31,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Phillip Webb * @author Phillip Webb
* @since 2.0.0 * @since 2.0.0
*/ */
@ConfigurationProperties(prefix = "endpoints.metrics.filter") @ConfigurationProperties(prefix = "management.metrics.filter")
public class MetricFilterProperties { public class MetricFilterProperties {
/** /**

@ -45,11 +45,32 @@
"vcap_services" "vcap_services"
] ]
}, },
{
"name": "endpoints.metrics.filter.counter-submissions",
"type": "java.util.Set<org.springframework.boot.actuate.metrics.web.servlet.MetricsFilterSubmission>",
"description": "Submissions that should be made to the counter.",
"deprecation": {
"replacement": "management.metrics.filter.counter-submissions",
"level": "error"
}
},
{ {
"name": "endpoints.metrics.filter.enabled", "name": "endpoints.metrics.filter.enabled",
"type": "java.lang.Boolean", "type": "java.lang.Boolean",
"description": "Enable the metrics servlet filter.", "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<org.springframework.boot.actuate.metrics.web.servlet.MetricsFilterSubmission>",
"description": "Submissions that should be made to the gauge.",
"deprecation": {
"replacement": "management.metrics.filter.gauge-submissions",
"level": "error"
}
}, },
{ {
"name": "endpoints.trace.filter.enabled", "name": "endpoints.trace.filter.enabled",
@ -186,6 +207,12 @@
"name": "management.info.git.mode", "name": "management.info.git.mode",
"defaultValue": "simple" "defaultValue": "simple"
}, },
{
"name": "management.metrics.filter.enabled",
"type": "java.lang.Boolean",
"description": "Enable the metrics servlet filter.",
"defaultValue": true
},
{ {
"name": "management.security.sessions", "name": "management.security.sessions",
"defaultValue": "stateless" "defaultValue": "stateless"

@ -236,7 +236,7 @@ public class MetricFilterAutoConfigurationTests {
@Test @Test
public void skipsFilterIfPropertyDisabled() throws Exception { public void skipsFilterIfPropertyDisabled() throws Exception {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); 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.register(Config.class, MetricFilterAutoConfiguration.class);
context.refresh(); context.refresh();
assertThat(context.getBeansOfType(Filter.class).size()).isEqualTo(0); assertThat(context.getBeansOfType(Filter.class).size()).isEqualTo(0);
@ -357,8 +357,8 @@ public class MetricFilterAutoConfigurationTests {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(Config.class, MetricFilterAutoConfiguration.class); context.register(Config.class, MetricFilterAutoConfiguration.class);
TestPropertyValues TestPropertyValues
.of("endpoints.metrics.filter.gauge-submissions=merged,per-http-method", .of("management.metrics.filter.gauge-submissions=merged,per-http-method",
"endpoints.metrics.filter.counter-submissions=merged,per-http-method") "management.metrics.filter.counter-submissions=merged,per-http-method")
.applyTo(context); .applyTo(context);
context.refresh(); context.refresh();
Filter filter = context.getBean(Filter.class); Filter filter = context.getBean(Filter.class);
@ -385,8 +385,8 @@ public class MetricFilterAutoConfigurationTests {
public void doesNotRecordRolledUpMetricsIfConfigured() throws Exception { public void doesNotRecordRolledUpMetricsIfConfigured() throws Exception {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(Config.class, MetricFilterAutoConfiguration.class); context.register(Config.class, MetricFilterAutoConfiguration.class);
TestPropertyValues.of("endpoints.metrics.filter.gauge-submissions=", TestPropertyValues.of("management.metrics.filter.gauge-submissions=",
"endpoints.metrics.filter.counter-submissions=").applyTo(context); "management.metrics.filter.counter-submissions=").applyTo(context);
context.refresh(); context.refresh();
Filter filter = context.getBean(Filter.class); Filter filter = context.getBean(Filter.class);
MockHttpServletRequest request = new MockHttpServletRequest("PUT", "/test/path"); MockHttpServletRequest request = new MockHttpServletRequest("PUT", "/test/path");

@ -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.enabled=true # Enable the metrics endpoint.
endpoints.metrics.jmx.enabled=true # Expose the metrics endpoint as a JMX MBean. 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.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]) # 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. 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.enabled=false # Enable Jolokia.
management.jolokia.path=/jolokia # Path at which Jolokia will be available. 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]) # 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. management.trace.include=request-headers,response-headers,cookies,errors # Items to be included in the trace.

Loading…
Cancel
Save