|
|
|
|
@ -31,8 +31,12 @@ import org.junit.jupiter.api.Test;
@@ -31,8 +31,12 @@ import org.junit.jupiter.api.Test;
|
|
|
|
|
import org.junit.jupiter.api.extension.ExtendWith; |
|
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigurations; |
|
|
|
|
import org.springframework.boot.micrometer.metrics.MaximumAllowableTagsMeterFilter; |
|
|
|
|
import org.springframework.boot.micrometer.metrics.autoconfigure.MetricsAutoConfiguration; |
|
|
|
|
import org.springframework.boot.micrometer.metrics.autoconfigure.MetricsProperties; |
|
|
|
|
import org.springframework.boot.micrometer.observation.autoconfigure.ObservationAutoConfiguration; |
|
|
|
|
import org.springframework.boot.micrometer.observation.autoconfigure.ObservationProperties; |
|
|
|
|
import org.springframework.boot.test.context.FilteredClassLoader; |
|
|
|
|
import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext; |
|
|
|
|
import org.springframework.boot.test.context.runner.WebApplicationContextRunner; |
|
|
|
|
import org.springframework.boot.test.system.CapturedOutput; |
|
|
|
|
@ -74,6 +78,12 @@ class WebMvcObservationAutoConfigurationTests {
@@ -74,6 +78,12 @@ class WebMvcObservationAutoConfigurationTests {
|
|
|
|
|
.run((context) -> assertThat(context).doesNotHaveBean(FilterRegistrationBean.class)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void backsOffWhenObservationPropertiesIsMissing() { |
|
|
|
|
this.contextRunner.withClassLoader(new FilteredClassLoader(ObservationProperties.class)) |
|
|
|
|
.run((context) -> assertThat(context).doesNotHaveBean(FilterRegistrationBean.class)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void definesFilterWhenRegistryIsPresent() { |
|
|
|
|
this.contextRunner.run((context) -> { |
|
|
|
|
@ -171,6 +181,12 @@ class WebMvcObservationAutoConfigurationTests {
@@ -171,6 +181,12 @@ class WebMvcObservationAutoConfigurationTests {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void shouldBackOffIfMetricsPropertiesIsNotPresent() { |
|
|
|
|
this.contextRunner.withClassLoader(new FilteredClassLoader(MetricsProperties.class)) |
|
|
|
|
.run((context) -> assertThat(context).doesNotHaveBean(MaximumAllowableTagsMeterFilter.class)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private MeterRegistry getInitializedMeterRegistry(AssertableWebApplicationContext context) { |
|
|
|
|
return getInitializedMeterRegistry(context, "/test0", "/test1", "/test2"); |
|
|
|
|
} |
|
|
|
|
|