|
|
|
|
@ -45,6 +45,7 @@ import org.springframework.context.annotation.Import;
@@ -45,6 +45,7 @@ import org.springframework.context.annotation.Import;
|
|
|
|
|
import org.springframework.test.util.ReflectionTestUtils; |
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
|
import static org.mockito.Mockito.mock; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Tests for {@link PrometheusMetricsExportAutoConfiguration}. |
|
|
|
|
@ -125,6 +126,15 @@ class PrometheusMetricsExportAutoConfigurationTests {
@@ -125,6 +126,15 @@ class PrometheusMetricsExportAutoConfigurationTests {
|
|
|
|
|
.hasSingleBean(PrometheusMeterRegistry.class)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void allowsCustomExemplarSamplerToBeUsed() { |
|
|
|
|
this.contextRunner.withUserConfiguration(ExemplarsConfiguration.class) |
|
|
|
|
.withBean("customExemplarSampler", ExemplarSampler.class, () -> mock(ExemplarSampler.class)) |
|
|
|
|
.run((context) -> assertThat(context).hasSingleBean(ExemplarSampler.class) |
|
|
|
|
.getBean(ExemplarSampler.class) |
|
|
|
|
.isSameAs(context.getBean("customExemplarSampler"))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void exemplarSamplerIsNotAutoConfiguredIfSpanContextSupplierIsMissing() { |
|
|
|
|
this.contextRunner.withUserConfiguration(BaseConfiguration.class) |
|
|
|
|
|