Skip to content

Commit

Permalink
Make Span name consistent with http.route.name
Browse files Browse the repository at this point in the history
Expected operation name is prefixed with forward slash is now as span name creation strategy has [recently changed](quarkusio/quarkus#24017)

(cherry picked from commit 4564b78)
  • Loading branch information
michalvavrik authored and pablo gonzalez granados committed Jun 14, 2022
1 parent d675e25 commit 1267d94
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1267d94

Please sign in to comment.