Merge branch '2.2.x'

This commit is contained in:
Marcin Grzejszczak
2021-02-26 14:17:34 +01:00
5 changed files with 27 additions and 14 deletions

View File

@@ -35,6 +35,10 @@ public class Pair {
return new Pair(key, value);
}
public static Pair onHook() {
return new Pair("spring.sleuth.reactor.instrumentation-type", SleuthReactorProperties.InstrumentationType.DECORATE_QUEUES.name());
}
public static Pair noSleuth() {
return new Pair("spring.sleuth.enabled", "false");
}

View File

@@ -40,6 +40,7 @@ import org.openjdk.jmh.annotations.Warmup;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.cloud.sleuth.benchmarks.app.stream.SleuthBenchmarkingStreamApplication;
import org.springframework.cloud.sleuth.benchmarks.jmh.Pair;
import org.springframework.cloud.sleuth.benchmarks.jmh.TracerImplementation;
@@ -54,9 +55,9 @@ import org.springframework.messaging.support.MessageBuilder;
import static org.assertj.core.api.Assertions.assertThat;
@Measurement(iterations = 5, time = 1)
@Warmup(iterations = 5, time = 1)
@Fork(2)
@Measurement(iterations = 10, time = 1)
@Warmup(iterations = 10, time = 1)
@Fork(4)
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Microbenchmark
@@ -133,6 +134,7 @@ public class MicroBenchmarkStreamTests {
} else {
assertThat(b3).startsWith("4883117762eb9420");
}
assertThat(this.applicationContext.getBean(Tracer.class).currentSpan()).isNull();
}
}
@@ -154,7 +156,7 @@ public class MicroBenchmarkStreamTests {
// @formatter:off
noSleuthSimple(Pair.noSleuth(), function("simple")),
sleuthSimpleOnQueues(function("simple")),
sleuthSimpleOnQueues(function("simple"), Pair.onHook()),
sleuthSimpleManual(function("simple_manual"), Pair.manual(), functionDisabled(), integrationDisabled()),
sleuthSimpleNoFunctionInstrumentationManual(function("simple_manual"), Pair.manual(), functionDisabled(), integrationEnabled()),
sleuthSimpleOnEach(function("simple"), Pair.onEach()),

View File

@@ -41,15 +41,18 @@ import org.openjdk.jmh.annotations.Warmup;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.cloud.sleuth.benchmarks.app.webflux.SleuthBenchmarkingSpringWebFluxApp;
import org.springframework.cloud.sleuth.benchmarks.jmh.Pair;
import org.springframework.cloud.sleuth.benchmarks.jmh.TracerImplementation;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.web.reactive.server.WebTestClient;
@Measurement(iterations = 5, time = 1)
@Warmup(iterations = 5, time = 1)
@Fork(2)
import static org.assertj.core.api.Assertions.assertThat;
@Measurement(iterations = 10, time = 1)
@Warmup(iterations = 10, time = 1)
@Fork(4)
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Microbenchmark
@@ -98,6 +101,7 @@ public class MicroBenchmarkHttpTests {
void run() {
this.webTestClient.get().uri(instrumentation.url).header("X-B3-TraceId", "4883117762eb9420")
.header("X-B3-SpanId", "4883117762eb9420").exchange().expectStatus().isOk();
assertThat(this.applicationContext.getBean(Tracer.class).currentSpan()).isNull();
}
@TearDown
@@ -118,12 +122,12 @@ public class MicroBenchmarkHttpTests {
// @formatter:off
noSleuthSimple("/simple", Pair.noSleuth()),
sleuthSimpleOnHooks("/simple"),
sleuthSimpleManual("/simpleManual", Pair.manual()),
sleuthSimpleOnEach("/simple", Pair.onEach()),
sleuthSimpleOnLast("/simple", Pair.onLast()),
onQueuesSimple("/simple", Pair.onHook()),
onManualSimple("/simpleManual", Pair.manual()),
onEachSimple("/simple", Pair.onEach()),
onLastSimple("/simple", Pair.onLast()),
noSleuthComplex("/complexNoSleuth", Pair.noSleuth()),
onHooksComplex("/complex"),
onQueueComplex("/complex", Pair.onHook()),
onManualComplex("/complexManual", Pair.manual()),
onEachComplex("/complex", Pair.onEach()),
onLastComplex("/complex", Pair.onLast());