Remove deprecated Actuator metrics 2.2 code

See gh-19699
This commit is contained in:
Scott Frederick
2020-01-14 13:03:19 -06:00
committed by Stephane Nicoll
parent 03139f066b
commit 1f1b06dfe2
8 changed files with 5 additions and 174 deletions

View File

@@ -20,7 +20,6 @@ import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
/**
@@ -110,28 +109,6 @@ public class MetricsProperties {
return this.request;
}
/**
* Return the name of the metric for client requests.
* @return request metric name
* @deprecated since 2.2.0 in favor of {@link ClientRequest#getMetricName()}
*/
@Deprecated
@DeprecatedConfigurationProperty(replacement = "management.metrics.web.client.request.metric-name")
public String getRequestsMetricName() {
return this.request.getMetricName();
}
/**
* Set the name of the metric for client requests.
* @param requestsMetricName request metric name
* @deprecated since 2.2.0 in favor of
* {@link ClientRequest#setMetricName(String)}
*/
@Deprecated
public void setRequestsMetricName(String requestsMetricName) {
this.request.setMetricName(requestsMetricName);
}
public int getMaxUriTags() {
return this.maxUriTags;
}
@@ -184,50 +161,6 @@ public class MetricsProperties {
return this.request;
}
/**
* Return whether server requests should be automatically timed.
* @return {@code true} if server request should be automatically timed
* @deprecated since 2.2.0 in favor of {@link AutoTimeProperties#isEnabled()}
*/
@DeprecatedConfigurationProperty(replacement = "management.metrics.web.server.request.autotime.enabled")
@Deprecated
public boolean isAutoTimeRequests() {
return this.request.getAutotime().isEnabled();
}
/**
* Set whether server requests should be automatically timed.
* @param autoTimeRequests whether server requests should be automatically
* timed
* @deprecated since 2.2.0 in favor of {@link AutoTimeProperties#isEnabled()}
*/
@Deprecated
public void setAutoTimeRequests(boolean autoTimeRequests) {
this.request.getAutotime().setEnabled(autoTimeRequests);
}
/**
* Return name of the metric for server requests.
* @return request metric name
* @deprecated since 2.2.0 in favor of {@link ServerRequest#getMetricName()}
*/
@DeprecatedConfigurationProperty(replacement = "management.metrics.web.server.request.metric-name")
@Deprecated
public String getRequestsMetricName() {
return this.request.getMetricName();
}
/**
* Set the name of the metric for server requests.
* @param requestsMetricName request metric name
* @deprecated since 2.2.0 in favor of
* {@link ServerRequest#setMetricName(String)}
*/
@Deprecated
public void setRequestsMetricName(String requestsMetricName) {
this.request.setMetricName(requestsMetricName);
}
public int getMaxUriTags() {
return this.maxUriTags;
}

View File

@@ -112,17 +112,6 @@ class WebFluxMetricsAutoConfigurationTests {
});
}
@Test
@Deprecated
void metricsAreNotRecordedIfAutoTimeRequestsIsDisabledWithDeprecatedProperty() {
this.contextRunner.withConfiguration(AutoConfigurations.of(WebFluxAutoConfiguration.class))
.withUserConfiguration(TestController.class)
.withPropertyValues("management.metrics.web.server.auto-time-requests=false").run((context) -> {
MeterRegistry registry = getInitializedMeterRegistry(context);
assertThat(registry.find("http.server.requests").meter()).isNull();
});
}
private MeterRegistry getInitializedMeterRegistry(AssertableReactiveWebApplicationContext context) {
WebTestClient webTestClient = WebTestClient.bindToApplicationContext(context).build();
for (int i = 0; i < 3; i++) {