Fix invalid Zipkin Reporter back-off behavior

Update `ReporterConfiguration` so that `spanReporter` back off
if a `Reporter` bean is defined. Prior to this commit, only
`AsyncReporter` beans would be considered.

See gh-35455
This commit is contained in:
ryosuke-hasebe
2023-05-17 13:54:13 +09:00
committed by Phillip Webb
parent 9245f3c25e
commit 903e19854d
2 changed files with 6 additions and 5 deletions

View File

@@ -120,7 +120,7 @@ class ZipkinConfigurations {
@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(Sender.class)
AsyncReporter<Span> spanReporter(Sender sender, BytesEncoder<Span> encoder) {
Reporter<Span> spanReporter(Sender sender, BytesEncoder<Span> encoder) {
return AsyncReporter.builder(sender).build(encoder);
}

View File

@@ -56,10 +56,11 @@ class ZipkinConfigurationsReporterConfigurationTests {
@Test
void shouldBackOffOnCustomBeans() {
this.contextRunner.withUserConfiguration(CustomConfiguration.class).run((context) -> {
assertThat(context).hasBean("customReporter");
assertThat(context).hasSingleBean(Reporter.class);
});
this.contextRunner.withUserConfiguration(SenderConfiguration.class, CustomConfiguration.class)
.run((context) -> {
assertThat(context).hasBean("customReporter");
assertThat(context).hasSingleBean(Reporter.class);
});
}
@Configuration(proxyBeanMethods = false)