|
|
|
@ -19,6 +19,7 @@ package org.springframework.boot.actuate.autoconfigure.observation.web.client;
|
|
|
|
|
import java.time.Duration;
|
|
|
|
|
|
|
|
|
|
import io.micrometer.common.KeyValues;
|
|
|
|
|
import io.micrometer.core.instrument.MeterRegistry;
|
|
|
|
|
import io.micrometer.observation.ObservationRegistry;
|
|
|
|
|
import io.micrometer.observation.tck.TestObservationRegistry;
|
|
|
|
|
import io.micrometer.observation.tck.TestObservationRegistryAssert;
|
|
|
|
@ -105,8 +106,12 @@ class WebClientObservationConfigurationTests {
|
|
|
|
|
void afterMaxUrisReachedFurtherUrisAreDenied(CapturedOutput output) {
|
|
|
|
|
this.contextRunner.withPropertyValues("management.metrics.web.client.max-uri-tags=2").run((context) -> {
|
|
|
|
|
TestObservationRegistry registry = getInitializedRegistry(context);
|
|
|
|
|
// TODO check size is 2
|
|
|
|
|
TestObservationRegistryAssert.assertThat(registry).hasObservationWithNameEqualTo("http.client.requests");
|
|
|
|
|
TestObservationRegistryAssert.assertThat(registry)
|
|
|
|
|
.hasNumberOfObservationsWithNameEqualTo("http.client.requests", 3);
|
|
|
|
|
MeterRegistry meterRegistry = context.getBean(MeterRegistry.class);
|
|
|
|
|
assertThat(meterRegistry.find("http.client.requests").timers()).hasSize(1);
|
|
|
|
|
// MeterFilter.maximumAllowableTags() works with prefix matching.
|
|
|
|
|
assertThat(meterRegistry.find("http.client.requests.active").longTaskTimers()).hasSize(1);
|
|
|
|
|
assertThat(output).contains("Reached the maximum number of URI tags for 'http.client.requests'.")
|
|
|
|
|
.contains("Are you using 'uriVariables'?");
|
|
|
|
|
});
|
|
|
|
@ -116,8 +121,10 @@ class WebClientObservationConfigurationTests {
|
|
|
|
|
void shouldNotDenyNorLogIfMaxUrisIsNotReached(CapturedOutput output) {
|
|
|
|
|
this.contextRunner.withPropertyValues("management.metrics.web.client.max-uri-tags=5").run((context) -> {
|
|
|
|
|
TestObservationRegistry registry = getInitializedRegistry(context);
|
|
|
|
|
// TODO check size is 3
|
|
|
|
|
TestObservationRegistryAssert.assertThat(registry).hasObservationWithNameEqualTo("http.client.requests");
|
|
|
|
|
TestObservationRegistryAssert.assertThat(registry)
|
|
|
|
|
.hasNumberOfObservationsWithNameEqualTo("http.client.requests", 3);
|
|
|
|
|
MeterRegistry meterRegistry = context.getBean(MeterRegistry.class);
|
|
|
|
|
assertThat(meterRegistry.find("http.client.requests").timers()).hasSize(3);
|
|
|
|
|
assertThat(output).doesNotContain("Reached the maximum number of URI tags for 'http.client.requests'.")
|
|
|
|
|
.doesNotContain("Are you using 'uriVariables'?");
|
|
|
|
|
});
|
|
|
|
|