Skip to content

Commit 1f1b06d

Browse files
scottfredericksnicoll
authored andcommitted
Remove deprecated Actuator metrics 2.2 code
See gh-19699
1 parent 03139f0 commit 1f1b06d

File tree

8 files changed

+5
-174
lines changed

8 files changed

+5
-174
lines changed

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

-67
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.Map;
2121

2222
import org.springframework.boot.context.properties.ConfigurationProperties;
23-
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
2423
import org.springframework.boot.context.properties.NestedConfigurationProperty;
2524

2625
/**
@@ -110,28 +109,6 @@ public ClientRequest getRequest() {
110109
return this.request;
111110
}
112111

113-
/**
114-
* Return the name of the metric for client requests.
115-
* @return request metric name
116-
* @deprecated since 2.2.0 in favor of {@link ClientRequest#getMetricName()}
117-
*/
118-
@Deprecated
119-
@DeprecatedConfigurationProperty(replacement = "management.metrics.web.client.request.metric-name")
120-
public String getRequestsMetricName() {
121-
return this.request.getMetricName();
122-
}
123-
124-
/**
125-
* Set the name of the metric for client requests.
126-
* @param requestsMetricName request metric name
127-
* @deprecated since 2.2.0 in favor of
128-
* {@link ClientRequest#setMetricName(String)}
129-
*/
130-
@Deprecated
131-
public void setRequestsMetricName(String requestsMetricName) {
132-
this.request.setMetricName(requestsMetricName);
133-
}
134-
135112
public int getMaxUriTags() {
136113
return this.maxUriTags;
137114
}
@@ -184,50 +161,6 @@ public ServerRequest getRequest() {
184161
return this.request;
185162
}
186163

187-
/**
188-
* Return whether server requests should be automatically timed.
189-
* @return {@code true} if server request should be automatically timed
190-
* @deprecated since 2.2.0 in favor of {@link AutoTimeProperties#isEnabled()}
191-
*/
192-
@DeprecatedConfigurationProperty(replacement = "management.metrics.web.server.request.autotime.enabled")
193-
@Deprecated
194-
public boolean isAutoTimeRequests() {
195-
return this.request.getAutotime().isEnabled();
196-
}
197-
198-
/**
199-
* Set whether server requests should be automatically timed.
200-
* @param autoTimeRequests whether server requests should be automatically
201-
* timed
202-
* @deprecated since 2.2.0 in favor of {@link AutoTimeProperties#isEnabled()}
203-
*/
204-
@Deprecated
205-
public void setAutoTimeRequests(boolean autoTimeRequests) {
206-
this.request.getAutotime().setEnabled(autoTimeRequests);
207-
}
208-
209-
/**
210-
* Return name of the metric for server requests.
211-
* @return request metric name
212-
* @deprecated since 2.2.0 in favor of {@link ServerRequest#getMetricName()}
213-
*/
214-
@DeprecatedConfigurationProperty(replacement = "management.metrics.web.server.request.metric-name")
215-
@Deprecated
216-
public String getRequestsMetricName() {
217-
return this.request.getMetricName();
218-
}
219-
220-
/**
221-
* Set the name of the metric for server requests.
222-
* @param requestsMetricName request metric name
223-
* @deprecated since 2.2.0 in favor of
224-
* {@link ServerRequest#setMetricName(String)}
225-
*/
226-
@Deprecated
227-
public void setRequestsMetricName(String requestsMetricName) {
228-
this.request.setMetricName(requestsMetricName);
229-
}
230-
231164
public int getMaxUriTags() {
232165
return this.maxUriTags;
233166
}

Diff for: spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/reactive/WebFluxMetricsAutoConfigurationTests.java

-11
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,6 @@ void metricsAreNotRecordedIfAutoTimeRequestsIsDisabled() {
112112
});
113113
}
114114

115-
@Test
116-
@Deprecated
117-
void metricsAreNotRecordedIfAutoTimeRequestsIsDisabledWithDeprecatedProperty() {
118-
this.contextRunner.withConfiguration(AutoConfigurations.of(WebFluxAutoConfiguration.class))
119-
.withUserConfiguration(TestController.class)
120-
.withPropertyValues("management.metrics.web.server.auto-time-requests=false").run((context) -> {
121-
MeterRegistry registry = getInitializedMeterRegistry(context);
122-
assertThat(registry.find("http.server.requests").meter()).isNull();
123-
});
124-
}
125-
126115
private MeterRegistry getInitializedMeterRegistry(AssertableReactiveWebApplicationContext context) {
127116
WebTestClient webTestClient = WebTestClient.bindToApplicationContext(context).build();
128117
for (int i = 0; i < 3; i++) {

Diff for: spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/MetricsClientHttpRequestInterceptor.java

-14
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,6 @@ class MetricsClientHttpRequestInterceptor implements ClientHttpRequestIntercepto
5353

5454
private final AutoTimer autoTimer;
5555

56-
/**
57-
* Create a new {@code MetricsClientHttpRequestInterceptor}.
58-
* @param meterRegistry the registry to which metrics are recorded
59-
* @param tagProvider provider for metrics tags
60-
* @param metricName name of the metric to record
61-
* @deprecated since 2.2.0 in favor of
62-
* {@link #MetricsClientHttpRequestInterceptor(MeterRegistry, RestTemplateExchangeTagsProvider, String, AutoTimer)}
63-
*/
64-
@Deprecated
65-
MetricsClientHttpRequestInterceptor(MeterRegistry meterRegistry, RestTemplateExchangeTagsProvider tagProvider,
66-
String metricName) {
67-
this(meterRegistry, tagProvider, metricName, AutoTimer.ENABLED);
68-
}
69-
7056
/**
7157
* Create a new {@code MetricsClientHttpRequestInterceptor}.
7258
* @param meterRegistry the registry to which metrics are recorded

Diff for: spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/MetricsRestTemplateCustomizer.java

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -39,22 +39,6 @@ public class MetricsRestTemplateCustomizer implements RestTemplateCustomizer {
3939

4040
private final MetricsClientHttpRequestInterceptor interceptor;
4141

42-
/**
43-
* Creates a new {@code MetricsRestTemplateInterceptor} that will record metrics using
44-
* the given {@code meterRegistry} with tags provided by the given
45-
* {@code tagProvider}.
46-
* @param meterRegistry the meter registry
47-
* @param tagProvider the tag provider
48-
* @param metricName the name of the recorded metric
49-
* @deprecated since 2.2.0 in favor of
50-
* {@link #MetricsRestTemplateCustomizer(MeterRegistry, RestTemplateExchangeTagsProvider, String, AutoTimer)}
51-
*/
52-
@Deprecated
53-
public MetricsRestTemplateCustomizer(MeterRegistry meterRegistry, RestTemplateExchangeTagsProvider tagProvider,
54-
String metricName) {
55-
this(meterRegistry, tagProvider, metricName, AutoTimer.ENABLED);
56-
}
57-
5842
/**
5943
* Creates a new {@code MetricsRestTemplateInterceptor}. When {@code autoTimeRequests}
6044
* is set to {@code true}, the interceptor records metrics using the given

Diff for: spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/MetricsWebClientCustomizer.java

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,22 +33,6 @@ public class MetricsWebClientCustomizer implements WebClientCustomizer {
3333

3434
private final MetricsWebClientFilterFunction filterFunction;
3535

36-
/**
37-
* Create a new {@code MetricsWebClientFilterFunction} that will record metrics using
38-
* the given {@code meterRegistry} with tags provided by the given
39-
* {@code tagProvider}.
40-
* @param meterRegistry the meter registry
41-
* @param tagProvider the tag provider
42-
* @param metricName the name of the recorded metric
43-
* @deprecated since 2.2.0 in favor of
44-
* {@link #MetricsWebClientCustomizer(MeterRegistry, WebClientExchangeTagsProvider, String, AutoTimer)}
45-
*/
46-
@Deprecated
47-
public MetricsWebClientCustomizer(MeterRegistry meterRegistry, WebClientExchangeTagsProvider tagProvider,
48-
String metricName) {
49-
this(meterRegistry, tagProvider, metricName, AutoTimer.ENABLED);
50-
}
51-
5236
/**
5337
* Create a new {@code MetricsWebClientFilterFunction} that will record metrics using
5438
* the given {@code meterRegistry} with tags provided by the given

Diff for: spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/MetricsWebClientFilterFunction.java

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -50,20 +50,6 @@ public class MetricsWebClientFilterFunction implements ExchangeFilterFunction {
5050

5151
private final AutoTimer autoTimer;
5252

53-
/**
54-
* Create a new {@code MetricsWebClientFilterFunction}.
55-
* @param meterRegistry the registry to which metrics are recorded
56-
* @param tagProvider provider for metrics tags
57-
* @param metricName name of the metric to record
58-
* @deprecated since 2.2.0 in favor of
59-
* {@link #MetricsWebClientFilterFunction(MeterRegistry, WebClientExchangeTagsProvider, String, AutoTimer)}
60-
*/
61-
@Deprecated
62-
public MetricsWebClientFilterFunction(MeterRegistry meterRegistry, WebClientExchangeTagsProvider tagProvider,
63-
String metricName) {
64-
this(meterRegistry, tagProvider, metricName, AutoTimer.ENABLED);
65-
}
66-
6753
/**
6854
* Create a new {@code MetricsWebClientFilterFunction}.
6955
* @param meterRegistry the registry to which metrics are recorded

Diff for: spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java

+1-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -49,21 +49,6 @@ public class MetricsWebFilter implements WebFilter {
4949

5050
private final AutoTimer autoTimer;
5151

52-
/**
53-
* Create a new {@code MetricsWebFilter}.
54-
* @param registry the registry to which metrics are recorded
55-
* @param tagsProvider provider for metrics tags
56-
* @param metricName name of the metric to record
57-
* @param autoTimeRequests if requests should be automatically timed
58-
* @deprecated since 2.2.0 in favor of
59-
* {@link #MetricsWebFilter(MeterRegistry, WebFluxTagsProvider, String, AutoTimer)}
60-
*/
61-
@Deprecated
62-
public MetricsWebFilter(MeterRegistry registry, WebFluxTagsProvider tagsProvider, String metricName,
63-
boolean autoTimeRequests) {
64-
this(registry, tagsProvider, metricName, AutoTimer.ENABLED);
65-
}
66-
6752
/**
6853
* Create a new {@code MetricsWebFilter}.
6954
* @param registry the registry to which metrics are recorded

Diff for: spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -60,22 +60,6 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
6060

6161
private final AutoTimer autoTimer;
6262

63-
/**
64-
* Create a new {@link WebMvcMetricsFilter} instance.
65-
* @param registry the meter registry
66-
* @param tagsProvider the tags provider
67-
* @param metricName the metric name
68-
* @param autoTimeRequests if requests should be automatically timed
69-
* @since 2.0.7
70-
* @deprecated since 2.2.0 in favor of
71-
* {@link #WebMvcMetricsFilter(MeterRegistry, WebMvcTagsProvider, String, AutoTimer)}
72-
*/
73-
@Deprecated
74-
public WebMvcMetricsFilter(MeterRegistry registry, WebMvcTagsProvider tagsProvider, String metricName,
75-
boolean autoTimeRequests) {
76-
this(registry, tagsProvider, metricName, AutoTimer.ENABLED);
77-
}
78-
7963
/**
8064
* Create a new {@link WebMvcMetricsFilter} instance.
8165
* @param registry the meter registry

0 commit comments

Comments
 (0)