Skip to content

Commit

Permalink
Allow for asynchronousness in span processing
Browse files Browse the repository at this point in the history
  • Loading branch information
holly-cummins committed Jan 30, 2025
1 parent 9a300e3 commit d24fa93
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import static io.quarkus.it.opentelemetry.reactive.Utils.getSpans;
import static io.quarkus.it.opentelemetry.reactive.Utils.getSpansByKindAndParentId;
import static io.restassured.RestAssured.given;
import static io.restassured.RestAssured.when;
import static java.net.HttpURLConnection.HTTP_OK;
import static java.util.concurrent.TimeUnit.SECONDS;
import static java.util.stream.Collectors.toSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import static io.opentelemetry.api.trace.SpanKind.INTERNAL;
import static io.quarkus.it.opentelemetry.reactive.Utils.getSpanByKindAndParentId;
import static io.quarkus.it.opentelemetry.reactive.Utils.getSpans;
import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.net.URI;
import java.time.Duration;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -38,6 +40,14 @@ public class OpenTelemetryWithSpanAtStartupTest {

@Test
void testGeneratedSpansUsingRestClientReactive() {

// There's a bit of asynchronousness in recording and exporting the spans, so to avoid issues, give the startup spans a (small) moment to arrive
await().atMost(Duration.ofSeconds(5L)).pollDelay(Duration.ofMillis(50)).until(() -> {
// make sure spans are cleared
List<Map<String, Object>> spans = getSpans();
return !spans.isEmpty();
});

List<Map<String, Object>> spans = getSpans();
assertEquals(2, spans.size());

Expand Down

0 comments on commit d24fa93

Please sign in to comment.