Make auto-configured BraveTracer back off when user defines a Tracer

Closes gh-33095
pull/33098/head
Andy Wilkinson 2 years ago
parent 12c77dba1c
commit d91e16a6c5

@ -160,7 +160,7 @@ public class BraveAutoConfiguration {
}
@Bean
@ConditionalOnMissingBean
@ConditionalOnMissingBean(io.micrometer.tracing.Tracer.class)
BraveTracer braveTracerBridge(brave.Tracer tracer, CurrentTraceContext currentTraceContext) {
return new BraveTracer(tracer, new BraveCurrentTraceContext(currentTraceContext), BRAVE_BAGGAGE_MANAGER);
}

@ -113,8 +113,8 @@ class BraveAutoConfigurationTests {
assertThat(context).hasSingleBean(HttpServerHandler.class);
assertThat(context).hasBean("customHttpClientHandler");
assertThat(context).hasSingleBean(HttpClientHandler.class);
assertThat(context).hasBean("customBraveTracer");
assertThat(context).hasSingleBean(BraveTracer.class);
assertThat(context).hasBean("customMicrometerTracer");
assertThat(context).hasSingleBean(io.micrometer.tracing.Tracer.class);
assertThat(context).hasBean("customBraveBaggageManager");
assertThat(context).hasSingleBean(BraveBaggageManager.class);
assertThat(context).hasBean("customBraveHttpServerHandler");
@ -397,8 +397,8 @@ class BraveAutoConfigurationTests {
}
@Bean
BraveTracer customBraveTracer() {
return mock(BraveTracer.class);
io.micrometer.tracing.Tracer customMicrometerTracer() {
return mock(io.micrometer.tracing.Tracer.class);
}
@Bean

Loading…
Cancel
Save