|
|
@ -25,21 +25,12 @@ import brave.Tracing;
|
|
|
|
import brave.baggage.BaggagePropagation;
|
|
|
|
import brave.baggage.BaggagePropagation;
|
|
|
|
import brave.baggage.CorrelationScopeConfig.SingleCorrelationField;
|
|
|
|
import brave.baggage.CorrelationScopeConfig.SingleCorrelationField;
|
|
|
|
import brave.handler.SpanHandler;
|
|
|
|
import brave.handler.SpanHandler;
|
|
|
|
import brave.http.HttpClientHandler;
|
|
|
|
|
|
|
|
import brave.http.HttpClientRequest;
|
|
|
|
|
|
|
|
import brave.http.HttpClientResponse;
|
|
|
|
|
|
|
|
import brave.http.HttpServerHandler;
|
|
|
|
|
|
|
|
import brave.http.HttpServerRequest;
|
|
|
|
|
|
|
|
import brave.http.HttpServerResponse;
|
|
|
|
|
|
|
|
import brave.http.HttpTracing;
|
|
|
|
|
|
|
|
import brave.propagation.CurrentTraceContext;
|
|
|
|
import brave.propagation.CurrentTraceContext;
|
|
|
|
import brave.propagation.CurrentTraceContext.ScopeDecorator;
|
|
|
|
import brave.propagation.CurrentTraceContext.ScopeDecorator;
|
|
|
|
import brave.propagation.Propagation;
|
|
|
|
import brave.propagation.Propagation;
|
|
|
|
import brave.propagation.Propagation.Factory;
|
|
|
|
import brave.propagation.Propagation.Factory;
|
|
|
|
import brave.sampler.Sampler;
|
|
|
|
import brave.sampler.Sampler;
|
|
|
|
import io.micrometer.tracing.brave.bridge.BraveBaggageManager;
|
|
|
|
import io.micrometer.tracing.brave.bridge.BraveBaggageManager;
|
|
|
|
import io.micrometer.tracing.brave.bridge.BraveHttpClientHandler;
|
|
|
|
|
|
|
|
import io.micrometer.tracing.brave.bridge.BraveHttpServerHandler;
|
|
|
|
|
|
|
|
import io.micrometer.tracing.brave.bridge.BraveSpanCustomizer;
|
|
|
|
import io.micrometer.tracing.brave.bridge.BraveSpanCustomizer;
|
|
|
|
import io.micrometer.tracing.brave.bridge.BraveTracer;
|
|
|
|
import io.micrometer.tracing.brave.bridge.BraveTracer;
|
|
|
|
import io.micrometer.tracing.brave.bridge.CompositeSpanHandler;
|
|
|
|
import io.micrometer.tracing.brave.bridge.CompositeSpanHandler;
|
|
|
@ -49,7 +40,6 @@ import io.micrometer.tracing.exporter.SpanFilter;
|
|
|
|
import io.micrometer.tracing.exporter.SpanReporter;
|
|
|
|
import io.micrometer.tracing.exporter.SpanReporter;
|
|
|
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
|
|
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import org.mockito.Answers;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.actuate.autoconfigure.tracing.BraveAutoConfigurationTests.SpanHandlerConfiguration.AdditionalSpanHandler;
|
|
|
|
import org.springframework.boot.actuate.autoconfigure.tracing.BraveAutoConfigurationTests.SpanHandlerConfiguration.AdditionalSpanHandler;
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
|
|
@ -81,17 +71,10 @@ class BraveAutoConfigurationTests {
|
|
|
|
assertThat(context).hasSingleBean(CurrentTraceContext.class);
|
|
|
|
assertThat(context).hasSingleBean(CurrentTraceContext.class);
|
|
|
|
assertThat(context).hasSingleBean(Factory.class);
|
|
|
|
assertThat(context).hasSingleBean(Factory.class);
|
|
|
|
assertThat(context).hasSingleBean(Sampler.class);
|
|
|
|
assertThat(context).hasSingleBean(Sampler.class);
|
|
|
|
assertThat(context).hasSingleBean(HttpTracing.class);
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(HttpServerHandler.class);
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(HttpClientHandler.class);
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(BraveTracer.class);
|
|
|
|
assertThat(context).hasSingleBean(BraveTracer.class);
|
|
|
|
assertThat(context).hasSingleBean(BraveHttpServerHandler.class);
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(BraveHttpClientHandler.class);
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(Propagation.Factory.class);
|
|
|
|
assertThat(context).hasSingleBean(Propagation.Factory.class);
|
|
|
|
assertThat(context).hasSingleBean(BaggagePropagation.FactoryBuilder.class);
|
|
|
|
assertThat(context).hasSingleBean(BaggagePropagation.FactoryBuilder.class);
|
|
|
|
assertThat(context).hasSingleBean(BraveTracer.class);
|
|
|
|
assertThat(context).hasSingleBean(BraveTracer.class);
|
|
|
|
assertThat(context).hasSingleBean(BraveHttpServerHandler.class);
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(BraveHttpClientHandler.class);
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(CompositeSpanHandler.class);
|
|
|
|
assertThat(context).hasSingleBean(CompositeSpanHandler.class);
|
|
|
|
assertThat(context).hasSingleBean(SpanCustomizer.class);
|
|
|
|
assertThat(context).hasSingleBean(SpanCustomizer.class);
|
|
|
|
assertThat(context).hasSingleBean(BraveSpanCustomizer.class);
|
|
|
|
assertThat(context).hasSingleBean(BraveSpanCustomizer.class);
|
|
|
@ -111,24 +94,10 @@ class BraveAutoConfigurationTests {
|
|
|
|
assertThat(context).hasSingleBean(Factory.class);
|
|
|
|
assertThat(context).hasSingleBean(Factory.class);
|
|
|
|
assertThat(context).hasBean("customSampler");
|
|
|
|
assertThat(context).hasBean("customSampler");
|
|
|
|
assertThat(context).hasSingleBean(Sampler.class);
|
|
|
|
assertThat(context).hasSingleBean(Sampler.class);
|
|
|
|
assertThat(context).hasBean("customHttpTracing");
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(HttpTracing.class);
|
|
|
|
|
|
|
|
assertThat(context).hasBean("customHttpServerHandler");
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(HttpServerHandler.class);
|
|
|
|
|
|
|
|
assertThat(context).hasBean("customHttpClientHandler");
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(HttpClientHandler.class);
|
|
|
|
|
|
|
|
assertThat(context).hasBean("customMicrometerTracer");
|
|
|
|
assertThat(context).hasBean("customMicrometerTracer");
|
|
|
|
assertThat(context).hasSingleBean(io.micrometer.tracing.Tracer.class);
|
|
|
|
assertThat(context).hasSingleBean(io.micrometer.tracing.Tracer.class);
|
|
|
|
assertThat(context).hasBean("customBraveBaggageManager");
|
|
|
|
assertThat(context).hasBean("customBraveBaggageManager");
|
|
|
|
assertThat(context).hasSingleBean(BraveBaggageManager.class);
|
|
|
|
assertThat(context).hasSingleBean(BraveBaggageManager.class);
|
|
|
|
assertThat(context).hasBean("customBraveHttpServerHandler");
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(BraveHttpServerHandler.class);
|
|
|
|
|
|
|
|
assertThat(context).hasBean("customBraveHttpClientHandler");
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(BraveHttpClientHandler.class);
|
|
|
|
|
|
|
|
assertThat(context).hasBean("customHttpServerHandler");
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(HttpServerHandler.class);
|
|
|
|
|
|
|
|
assertThat(context).hasBean("customHttpClientHandler");
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(HttpClientHandler.class);
|
|
|
|
|
|
|
|
assertThat(context).hasBean("customCompositeSpanHandler");
|
|
|
|
assertThat(context).hasBean("customCompositeSpanHandler");
|
|
|
|
assertThat(context).hasSingleBean(CompositeSpanHandler.class);
|
|
|
|
assertThat(context).hasSingleBean(CompositeSpanHandler.class);
|
|
|
|
assertThat(context).hasBean("customSpanCustomizer");
|
|
|
|
assertThat(context).hasBean("customSpanCustomizer");
|
|
|
@ -140,11 +109,7 @@ class BraveAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
void shouldSupplyMicrometerBeans() {
|
|
|
|
void shouldSupplyMicrometerBeans() {
|
|
|
|
this.contextRunner.run((context) -> {
|
|
|
|
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(BraveTracer.class));
|
|
|
|
assertThat(context).hasSingleBean(BraveTracer.class);
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(BraveHttpServerHandler.class);
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(BraveHttpClientHandler.class);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -387,23 +352,6 @@ class BraveAutoConfigurationTests {
|
|
|
|
return mock(Sampler.class);
|
|
|
|
return mock(Sampler.class);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
HttpTracing customHttpTracing() {
|
|
|
|
|
|
|
|
return mock(HttpTracing.class);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
HttpServerHandler<HttpServerRequest, HttpServerResponse> customHttpServerHandler() {
|
|
|
|
|
|
|
|
HttpTracing httpTracing = mock(HttpTracing.class, Answers.RETURNS_MOCKS);
|
|
|
|
|
|
|
|
return HttpServerHandler.create(httpTracing);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
HttpClientHandler<HttpClientRequest, HttpClientResponse> customHttpClientHandler() {
|
|
|
|
|
|
|
|
HttpTracing httpTracing = mock(HttpTracing.class, Answers.RETURNS_MOCKS);
|
|
|
|
|
|
|
|
return HttpClientHandler.create(httpTracing);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
io.micrometer.tracing.Tracer customMicrometerTracer() {
|
|
|
|
io.micrometer.tracing.Tracer customMicrometerTracer() {
|
|
|
|
return mock(io.micrometer.tracing.Tracer.class);
|
|
|
|
return mock(io.micrometer.tracing.Tracer.class);
|
|
|
@ -414,16 +362,6 @@ class BraveAutoConfigurationTests {
|
|
|
|
return mock(BraveBaggageManager.class);
|
|
|
|
return mock(BraveBaggageManager.class);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
BraveHttpServerHandler customBraveHttpServerHandler() {
|
|
|
|
|
|
|
|
return mock(BraveHttpServerHandler.class);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
BraveHttpClientHandler customBraveHttpClientHandler() {
|
|
|
|
|
|
|
|
return mock(BraveHttpClientHandler.class);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
CompositeSpanHandler customCompositeSpanHandler() {
|
|
|
|
CompositeSpanHandler customCompositeSpanHandler() {
|
|
|
|
return new CompositeSpanHandler(Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
|
|
|
|
return new CompositeSpanHandler(Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
|
|
|
|