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

See gh-10007
This commit is contained in:
Stephane Nicoll
2017-08-29 17:04:59 +02:00
parent 4c7088981f
commit 54781c73b5
5 changed files with 40 additions and 11 deletions

View File

@@ -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 {

View File

@@ -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 {
/**

View File

@@ -45,11 +45,32 @@
"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",
"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<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",
@@ -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"

View File

@@ -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");