Skip to content

Commit 54781c7

Browse files
committed
Move endpoints.metrics.filter to management.metrics.filter
See gh-10007
1 parent 4c70889 commit 54781c7

File tree

5 files changed

+40
-11
lines changed

5 files changed

+40
-11
lines changed

Diff for: spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterAutoConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
@ConditionalOnClass({ Servlet.class, ServletRegistration.class,
4949
OncePerRequestFilter.class, HandlerMapping.class })
5050
@AutoConfigureAfter(MetricRepositoryAutoConfiguration.class)
51-
@ConditionalOnProperty(prefix = "endpoints.metrics.filter", name = "enabled", matchIfMissing = true)
51+
@ConditionalOnProperty(prefix = "management.metrics.filter", name = "enabled", matchIfMissing = true)
5252
@EnableConfigurationProperties({ MetricFilterProperties.class })
5353
public class MetricFilterAutoConfiguration {
5454

Diff for: spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterProperties.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @author Phillip Webb
3232
* @since 2.0.0
3333
*/
34-
@ConfigurationProperties(prefix = "endpoints.metrics.filter")
34+
@ConfigurationProperties(prefix = "management.metrics.filter")
3535
public class MetricFilterProperties {
3636

3737
/**

Diff for: spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json

+28-1
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,32 @@
4545
"vcap_services"
4646
]
4747
},
48+
{
49+
"name": "endpoints.metrics.filter.counter-submissions",
50+
"type": "java.util.Set<org.springframework.boot.actuate.metrics.web.servlet.MetricsFilterSubmission>",
51+
"description": "Submissions that should be made to the counter.",
52+
"deprecation": {
53+
"replacement": "management.metrics.filter.counter-submissions",
54+
"level": "error"
55+
}
56+
},
4857
{
4958
"name": "endpoints.metrics.filter.enabled",
5059
"type": "java.lang.Boolean",
5160
"description": "Enable the metrics servlet filter.",
52-
"defaultValue": true
61+
"deprecation": {
62+
"replacement": "management.metrics.filter.enabled",
63+
"level": "error"
64+
}
65+
},
66+
{
67+
"name": "endpoints.metrics.filter.gauge-submissions",
68+
"type": "java.util.Set<org.springframework.boot.actuate.metrics.web.servlet.MetricsFilterSubmission>",
69+
"description": "Submissions that should be made to the gauge.",
70+
"deprecation": {
71+
"replacement": "management.metrics.filter.gauge-submissions",
72+
"level": "error"
73+
}
5374
},
5475
{
5576
"name": "endpoints.trace.filter.enabled",
@@ -186,6 +207,12 @@
186207
"name": "management.info.git.mode",
187208
"defaultValue": "simple"
188209
},
210+
{
211+
"name": "management.metrics.filter.enabled",
212+
"type": "java.lang.Boolean",
213+
"description": "Enable the metrics servlet filter.",
214+
"defaultValue": true
215+
},
189216
{
190217
"name": "management.security.sessions",
191218
"defaultValue": "stateless"

Diff for: spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricFilterAutoConfigurationTests.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public void skipsFilterIfMissingServices() throws Exception {
236236
@Test
237237
public void skipsFilterIfPropertyDisabled() throws Exception {
238238
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
239-
TestPropertyValues.of("endpoints.metrics.filter.enabled:false").applyTo(context);
239+
TestPropertyValues.of("management.metrics.filter.enabled:false").applyTo(context);
240240
context.register(Config.class, MetricFilterAutoConfiguration.class);
241241
context.refresh();
242242
assertThat(context.getBeansOfType(Filter.class).size()).isEqualTo(0);
@@ -357,8 +357,8 @@ public void additionallyRecordsMetricsWithHttpMethodNameIfConfigured()
357357
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
358358
context.register(Config.class, MetricFilterAutoConfiguration.class);
359359
TestPropertyValues
360-
.of("endpoints.metrics.filter.gauge-submissions=merged,per-http-method",
361-
"endpoints.metrics.filter.counter-submissions=merged,per-http-method")
360+
.of("management.metrics.filter.gauge-submissions=merged,per-http-method",
361+
"management.metrics.filter.counter-submissions=merged,per-http-method")
362362
.applyTo(context);
363363
context.refresh();
364364
Filter filter = context.getBean(Filter.class);
@@ -385,8 +385,8 @@ public void additionallyRecordsMetricsWithHttpMethodNameIfConfigured()
385385
public void doesNotRecordRolledUpMetricsIfConfigured() throws Exception {
386386
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
387387
context.register(Config.class, MetricFilterAutoConfiguration.class);
388-
TestPropertyValues.of("endpoints.metrics.filter.gauge-submissions=",
389-
"endpoints.metrics.filter.counter-submissions=").applyTo(context);
388+
TestPropertyValues.of("management.metrics.filter.gauge-submissions=",
389+
"management.metrics.filter.counter-submissions=").applyTo(context);
390390
context.refresh();
391391
Filter filter = context.getBean(Filter.class);
392392
MockHttpServletRequest request = new MockHttpServletRequest("PUT", "/test/path");

Diff for: spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

+5-3
Original file line numberDiff line numberDiff line change
@@ -1173,9 +1173,6 @@ content into your application; rather pick only the properties that you need.
11731173
endpoints.metrics.enabled=true # Enable the metrics endpoint.
11741174
endpoints.metrics.jmx.enabled=true # Expose the metrics endpoint as a JMX MBean.
11751175
endpoints.metrics.web.enabled=false # Expose the metrics endpoint as a Web endpoint.
1176-
endpoints.metrics.filter.counter-submissions= # Submissions that should be made to the counter.
1177-
endpoints.metrics.filter.enabled=true # Enable the metrics servlet filter.
1178-
endpoints.metrics.filter.gauge-submissions= # Submissions that should be made to the gauge.
11791176
11801177
# SHUTDOWN ENDPOINT ({sc-spring-boot-actuator}/endpoint/ShutdownEndpoint.{sc-ext}[ShutdownEndpoint])
11811178
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.
12771274
management.jolokia.enabled=false # Enable Jolokia.
12781275
management.jolokia.path=/jolokia # Path at which Jolokia will be available.
12791276
1277+
# METRICS FILTER ({sc-spring-boot-actuator}/autoconfigure/metrics/MetricsFilterProperties.{sc-ext}[MetricsFilterProperties])
1278+
management.metrics.filter.counter-submissions= # Submissions that should be made to the counter.
1279+
management.metrics.filter.enabled=true # Enable the metrics servlet filter.
1280+
management.metrics.filter.gauge-submissions= # Submissions that should be made to the gauge.
1281+
12801282
# TRACING ({sc-spring-boot-actuator}/trace/TraceProperties.{sc-ext}[TraceProperties])
12811283
management.trace.include=request-headers,response-headers,cookies,errors # Items to be included in the trace.
12821284

0 commit comments

Comments
 (0)