diff --git a/benchmarks/pom.xml b/benchmarks/pom.xml
index 50c51b9ed..0972ea89a 100644
--- a/benchmarks/pom.xml
+++ b/benchmarks/pom.xml
@@ -41,7 +41,6 @@
4.9.0
0.2.0.RELEASE
1.26
- 3.1.4-SNAPSHOT
@@ -55,8 +54,8 @@
org.springframework.cloud
- spring-cloud-stream-dependencies
- ${spring-cloud-stream.version}
+ spring-cloud-sleuth
+ ${project.version}
pom
import
@@ -65,7 +64,7 @@
- ${project.groupId}
+ org.springframework.cloud
spring-cloud-starter-sleuth
@@ -150,7 +149,7 @@
org.awaitility
awaitility
- test
+ compile
diff --git a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/app/stream/SleuthBenchmarkingStreamApplication.java b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/app/stream/SleuthBenchmarkingStreamApplication.java
index 32f1fa718..6c176269d 100644
--- a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/app/stream/SleuthBenchmarkingStreamApplication.java
+++ b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/app/stream/SleuthBenchmarkingStreamApplication.java
@@ -23,6 +23,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
+import org.awaitility.Awaitility;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.publisher.Flux;
@@ -60,15 +61,16 @@ public class SleuthBenchmarkingStreamApplication {
// "DECORATE_ON_LAST");
// System.setProperty("spring.sleuth.reactor.instrumentation-type", "MANUAL");
System.setProperty("spring.sleuth.reactor.instrumentation-type", "DECORATE_QUEUES");
+ System.setProperty("spring.sleuth.integration.enabled", "true");
System.setProperty("spring.sleuth.function.type", "DECORATE_QUEUES");
ConfigurableApplicationContext context = SpringApplication.run(SleuthBenchmarkingStreamApplication.class, args);
- for (int i = 0; i < 1; i++) {
- InputDestination input = context.getBean(InputDestination.class);
- input.send(MessageBuilder.withPayload("hello".getBytes())
- .setHeader("b3", "4883117762eb9420-4883117762eb9420-1").build());
- log.info("Retrieving the message for tests");
- OutputDestination output = context.getBean(OutputDestination.class);
- Message message = output.receive(200L);
+ InputDestination input = context.getBean(InputDestination.class);
+ input.send(MessageBuilder.withPayload("hello".getBytes())
+ .setHeader("b3", "4883117762eb9420-4883117762eb9420-1").build());
+ log.info("Retrieving the message for tests");
+ OutputDestination output = context.getBean(OutputDestination.class);
+ Awaitility.await().untilAsserted( () -> {
+ Message message = output.receive(1L);
log.info("Got the message from output");
assertThat(message).isNotNull();
log.info("Message is not null");
@@ -77,7 +79,9 @@ public class SleuthBenchmarkingStreamApplication {
String b3 = message.getHeaders().get("b3", String.class);
log.info("Checking the b3 header [" + b3 + "]");
assertThat(b3).startsWith("4883117762eb9420");
- }
+ });
+ context.close();
+ System.exit(0);
}
@Bean
diff --git a/benchmarks/src/test/java/org/springframework/cloud/sleuth/benchmarks/jmh/stream/MicroBenchmarkStreamTests.java b/benchmarks/src/test/java/org/springframework/cloud/sleuth/benchmarks/jmh/stream/MicroBenchmarkStreamTests.java
index 6ce4905df..be5393769 100644
--- a/benchmarks/src/test/java/org/springframework/cloud/sleuth/benchmarks/jmh/stream/MicroBenchmarkStreamTests.java
+++ b/benchmarks/src/test/java/org/springframework/cloud/sleuth/benchmarks/jmh/stream/MicroBenchmarkStreamTests.java
@@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit;
import brave.Tracing;
import jmh.mbr.junit5.Microbenchmark;
+import org.awaitility.Awaitility;
import org.junit.platform.commons.annotation.Testable;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
@@ -114,12 +115,12 @@ public class MicroBenchmarkStreamTests {
void run() {
sendInputMessage();
- assertThatOutputMessageGotReceived();
+ Awaitility.await().untilAsserted(this::assertThatOutputMessageGotReceived);
}
private void assertThatOutputMessageGotReceived() {
// System.out.println("Retrieving the message for tests");
- Message message = output.receive(200L);
+ Message message = output.receive(1L);
// System.out.println("Got the message from output");
assertThat(message).isNotNull();
// System.out.println("Message is not null");