Polish "Allow configuration of auto-timed metrics"

This commit makes sure the "auto-time-requests" property is still
available in a deprecated fashion.

See gh-15988
This commit is contained in:
Stephane Nicoll
2019-05-14 11:20:59 +02:00
parent 128b41d43a
commit 4d8df3cc47
2 changed files with 39 additions and 0 deletions

View File

@@ -109,6 +109,20 @@ public class WebFluxMetricsAutoConfigurationTests {
});
}
@Test
@Deprecated
public 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)