First pass at flaky VertxReactivePropagationTest.highConcurrency#18511
First pass at flaky VertxReactivePropagationTest.highConcurrency#18511trask wants to merge 4 commits into
Conversation
# Conflicts: # instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version35Test/java/io/opentelemetry/javaagent/instrumentation/vertx/rx/v3_5/server/VertxReactivePropagationTest.java # instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version41Test/java/io/opentelemetry/javaagent/instrumentation/vertx/rx/v3_5/server/VertxReactivePropagationTest.java # instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version5Test/java/io/opentelemetry/javaagent/instrumentation/vertx/rx/v3_5/server/VertxReactivePropagationTest.java
There was a problem hiding this comment.
Pull request overview
This PR updates the Vert.x RxJava 3.5 VertxReactivePropagationTest.highConcurrency test variants to make failures more deterministic and easier to debug by adding bounded waits and ensuring all submitted request tasks complete before trace assertions run.
Changes:
- Add a timeout/assertion around the start latch to avoid silent hangs.
- Track
Futures from submitted tasks and wait for completion before asserting traces. - Update the test method signature to allow propagation of checked exceptions from task completion waits.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version35Test/java/io/opentelemetry/javaagent/instrumentation/vertx/rx/v3_5/server/VertxReactivePropagationTest.java | Add latch timeout assertion and wait for all task futures before validating traces. |
| instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version41Test/java/io/opentelemetry/javaagent/instrumentation/vertx/rx/v3_5/server/VertxReactivePropagationTest.java | Same concurrency test hardening (timeouts + Future waiting) for the 4.1 test variant. |
| instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version5Test/java/io/opentelemetry/javaagent/instrumentation/vertx/rx/v3_5/server/VertxReactivePropagationTest.java | Same concurrency test hardening (timeouts + Future waiting) for the 5.x test variant. |
| @@ -160,29 +163,36 @@ void highConcurrency() { | |||
| TextMapSetter<HttpRequestBuilder> setter = | |||
| (carrier, name, value) -> carrier.header(name, value); | |||
|
|
|||
| List<Future<?>> futures = new ArrayList<>(); | |||
There was a problem hiding this comment.
I guess this won't do anything to fix the flaky test. If you believe that waiting for all the submitted tasks helps I'd suggest to also change the highConcurrency method in AbstractHttpClientTest that these methods copy from.
I get why copilot is forcing recomputing the deadline, but it looks a bit too much effort. Maybe we could avoid it with the following
CompletableFuture<?>[] tasks = new CompletableFuture[count];
for (int i = 0; i < count; i++) {
tasks[i] = CompletableFuture.runAsync(job, pool);
}
latch.countDown();
CompletableFuture.allOf(tasks).get(30, SECONDS);
Extracted from #18508
I removed the manual context propagation because worried that might be hiding something.
But the other changes look good and could help narrow down future flaky diagnosis of this test.