From 1267d941c59b21163df816e81dc56c722fc4880e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Vav=C5=99=C3=ADk?= Date: Mon, 13 Jun 2022 11:25:57 +0200 Subject: [PATCH] Make Span name consistent with http.route.name Expected operation name is prefixed with forward slash is now as span name creation strategy has [recently changed](https://github.com/quarkusio/quarkus/pull/24017) (cherry picked from commit 4564b7899286751e216f66de3a60abe4868e60e3) --- .../ts/http/vertx/webclient/VertxWebClientIT.java | 13 ++++++------- .../reactive/OpentelemetryReactiveIT.java | 4 ++-- .../quarkus/ts/opentelemetry/OpentelemetryIT.java | 4 ++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/http/vertx-web-client/src/test/java/io/quarkus/ts/http/vertx/webclient/VertxWebClientIT.java b/http/vertx-web-client/src/test/java/io/quarkus/ts/http/vertx/webclient/VertxWebClientIT.java index da11b16f47..13c1765b57 100644 --- a/http/vertx-web-client/src/test/java/io/quarkus/ts/http/vertx/webclient/VertxWebClientIT.java +++ b/http/vertx-web-client/src/test/java/io/quarkus/ts/http/vertx/webclient/VertxWebClientIT.java @@ -51,6 +51,7 @@ public class VertxWebClientIT { private static final int REST_PORT = 16686; private static final int TRACE_PORT = 14250; + private static final String TRACE_PING_PATH = "/trace/ping"; private Response resp; @@ -106,38 +107,36 @@ public void getTimeoutWhenResponseItsTooSlow() { @Test public void endpointShouldTrace() { final int pageLimit = 50; - final String expectedOperationName = "trace/ping"; await().atMost(1, TimeUnit.MINUTES).pollInterval(Duration.ofSeconds(1)).untilAsserted(() -> { whenIMakePingRequest(); - thenRetrieveTraces(pageLimit, "1h", getServiceName(), expectedOperationName); + thenRetrieveTraces(pageLimit, "1h", getServiceName(), TRACE_PING_PATH); thenStatusCodeMustBe(HttpStatus.SC_OK); thenTraceDataSizeMustBe(greaterThan(0)); thenTraceSpanSizeMustBe(greaterThan(0)); thenTraceSpanTagsSizeMustBe(greaterThan(0)); thenTraceSpansOperationNameMustBe(not(empty())); - thenCheckOperationNamesIsEqualTo(expectedOperationName); + thenCheckOperationNamesIsEqualTo(TRACE_PING_PATH); }); } @Test public void httpClientShouldHaveHisOwnSpan() { final int pageLimit = 50; - final String expectedOperationName = "trace/ping"; await().atMost(1, TimeUnit.MINUTES).pollInterval(Duration.ofSeconds(1)).untilAsserted(() -> { whenIMakePingRequest(); - thenRetrieveTraces(pageLimit, "1h", getServiceName(), expectedOperationName); + thenRetrieveTraces(pageLimit, "1h", getServiceName(), TRACE_PING_PATH); thenStatusCodeMustBe(HttpStatus.SC_OK); thenTraceDataSizeMustBe(greaterThan(0)); thenTraceSpanSizeMustBe(greaterThan(1)); thenTraceSpanTagsSizeMustBe(greaterThan(0)); thenTraceSpansOperationNameMustBe(not(empty())); - thenCheckOperationNamesIsEqualTo(expectedOperationName); + thenCheckOperationNamesIsEqualTo(TRACE_PING_PATH); }); } private void whenIMakePingRequest() { given().when() - .get("/trace/ping") + .get(TRACE_PING_PATH) .then() .statusCode(HttpStatus.SC_OK).body(equalToIgnoringCase("ping-pong")); } diff --git a/monitoring/opentelemetry-reactive/src/test/java/io/quarkus/ts/opentelemetry/reactive/OpentelemetryReactiveIT.java b/monitoring/opentelemetry-reactive/src/test/java/io/quarkus/ts/opentelemetry/reactive/OpentelemetryReactiveIT.java index 81c99c8c5b..b1fc935889 100644 --- a/monitoring/opentelemetry-reactive/src/test/java/io/quarkus/ts/opentelemetry/reactive/OpentelemetryReactiveIT.java +++ b/monitoring/opentelemetry-reactive/src/test/java/io/quarkus/ts/opentelemetry/reactive/OpentelemetryReactiveIT.java @@ -47,8 +47,8 @@ public class OpentelemetryReactiveIT { @Test public void testContextPropagation() { int pageLimit = 10; - String operationName = "ping/pong"; - String[] operations = new String[] { "ping/pong", "hello", "hello" }; + String operationName = "/ping/pong"; + String[] operations = new String[] { "/ping/pong", "/hello", "/hello" }; await().atMost(1, TimeUnit.MINUTES).pollInterval(Duration.ofSeconds(1)).untilAsserted(() -> { whenDoPingPongRequest(); diff --git a/monitoring/opentelemetry/src/test/java/io/quarkus/ts/opentelemetry/OpentelemetryIT.java b/monitoring/opentelemetry/src/test/java/io/quarkus/ts/opentelemetry/OpentelemetryIT.java index b4582a3795..fd217d23cd 100644 --- a/monitoring/opentelemetry/src/test/java/io/quarkus/ts/opentelemetry/OpentelemetryIT.java +++ b/monitoring/opentelemetry/src/test/java/io/quarkus/ts/opentelemetry/OpentelemetryIT.java @@ -47,8 +47,8 @@ public class OpentelemetryIT { @Test public void testContextPropagation() { int pageLimit = 10; - String operationName = "ping/pong"; - String[] operations = new String[] { "ping/pong", "hello", "hello" }; + String operationName = "/ping/pong"; + String[] operations = new String[] { "/ping/pong", "/hello", "/hello" }; await().atMost(1, TimeUnit.MINUTES).pollInterval(Duration.ofSeconds(1)).untilAsserted(() -> { whenDoPingPongRequest();