Removes Zipkin dependency from all tests (#1645)

Brave's SpanHandler can report natively in other formats which have different
constraints than Zipkin and often extensions to the data model.

This change ports all tests away from Zipkin's types so that it is more clear
what's actually recorded vs what's a side-effect of Zipkin conversion.

This removes `BlockingQueueSpanReporter` which was never released, also.
This commit is contained in:
Adrian Cole
2020-05-18 17:02:29 +08:00
committed by GitHub
parent 99ce7cdd1c
commit 40785d642a
101 changed files with 1070 additions and 1319 deletions

View File

@@ -19,11 +19,10 @@ package org.springframework.cloud.sleuth.benchmarks.app.webflux;
import java.util.regex.Pattern;
import brave.sampler.Sampler;
import brave.handler.SpanHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import reactor.core.publisher.Mono;
import zipkin2.Span;
import zipkin2.reporter.Reporter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.WebApplicationType;
@@ -80,8 +79,10 @@ public class SleuthBenchmarkingSpringWebFluxApp
}
@Bean
public Reporter<Span> reporter() {
return Reporter.NOOP;
public SpanHandler spanHandler() {
return new SpanHandler() {
// intentionally anonymous to prevent logging fallback on NOOP
};
}
@Override

View File

@@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.concurrent.TimeUnit;
import brave.Tracing;
import brave.handler.SpanHandler;
import brave.http.HttpTracing;
import brave.httpclient.TracingHttpClientBuilder;
import brave.propagation.CurrentTraceContext;
@@ -45,7 +46,6 @@ import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import zipkin2.reporter.Reporter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
@@ -61,6 +61,9 @@ import org.springframework.context.ConfigurableApplicationContext;
@Threads(2)
@State(Scope.Benchmark)
public class SpringWebFluxBenchmarks {
static final SpanHandler FAKE_SPAN_HANDLER = new SpanHandler() {
// intentionally anonymous to prevent logging fallback on NOOP
};
protected static TraceContext defaultTraceContext = TraceContext.newBuilder()
.traceIdHigh(333L).traceId(444L).spanId(3).sampled(true).build();
@@ -109,9 +112,9 @@ public class SpringWebFluxBenchmarks {
baseUrl = "http://127.0.0.1:" + springWebFluxApp.port + "/foo";
client = newClient();
tracedClient = newClient(HttpTracing
.create(Tracing.newBuilder().spanReporter(Reporter.NOOP).build()));
.create(Tracing.newBuilder().addSpanHandler(FAKE_SPAN_HANDLER).build()));
unsampledClient = newClient(HttpTracing.create(Tracing.newBuilder()
.sampler(Sampler.NEVER_SAMPLE).spanReporter(Reporter.NOOP).build()));
.sampler(Sampler.NEVER_SAMPLE).addSpanHandler(FAKE_SPAN_HANDLER).build()));
postSetUp();
}