Skip to content

Commit

Permalink
Merge pull request #1091 from michalvavrik/feature/fix-otel-tests
Browse files Browse the repository at this point in the history
Fix OpenTelemetry traces operation names as they changed when OpenTelemetry was bumped to 1.23.1
  • Loading branch information
michalvavrik authored Mar 3, 2023
2 parents 40d30a0 + a115865 commit f7a59f9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void verifyTelemetry() {
Assertions.assertEquals("Plato", reactive.jsonPath().getString("data.friend_r.name"));

await().atMost(1, TimeUnit.MINUTES).pollInterval(Duration.ofSeconds(10)).untilAsserted(() -> {
String operation = "/graphql";
String operation = "POST /graphql";
Response traces = given().when()
.queryParam("operation", operation)
.queryParam("lookback", "1h")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class VertxWebClientIT {
static final String EXPECTED_VALUE = "Chuck Norris has already been to mars; that why there's no signs of life";
static final int DELAY = 3500; // must be greater than vertx.webclient.timeout-sec
private static final String TRACE_PING_PATH = "/trace/ping";
private static final String TRACE_PING_OPERATION_NAME = "GET " + TRACE_PING_PATH;

private Response resp;

Expand Down Expand Up @@ -106,13 +107,13 @@ public void endpointShouldTrace() {
final int pageLimit = 50;
await().atMost(1, TimeUnit.MINUTES).pollInterval(Duration.ofSeconds(1)).untilAsserted(() -> {
whenIMakePingRequest();
thenRetrieveTraces(pageLimit, "1h", getServiceName(), TRACE_PING_PATH);
thenRetrieveTraces(pageLimit, "1h", getServiceName(), TRACE_PING_OPERATION_NAME);
thenStatusCodeMustBe(HttpStatus.SC_OK);
thenTraceDataSizeMustBe(greaterThan(0));
thenTraceSpanSizeMustBe(greaterThan(0));
thenTraceSpanTagsSizeMustBe(greaterThan(0));
thenTraceSpansOperationNameMustBe(not(empty()));
thenCheckOperationNamesIsEqualTo(TRACE_PING_PATH);
thenCheckOperationNamesIsEqualTo(TRACE_PING_OPERATION_NAME);
});
}

Expand All @@ -121,13 +122,13 @@ public void httpClientShouldHaveHisOwnSpan() {
final int pageLimit = 50;
await().atMost(1, TimeUnit.MINUTES).pollInterval(Duration.ofSeconds(1)).untilAsserted(() -> {
whenIMakePingRequest();
thenRetrieveTraces(pageLimit, "1h", getServiceName(), TRACE_PING_PATH);
thenRetrieveTraces(pageLimit, "1h", getServiceName(), TRACE_PING_OPERATION_NAME);
thenStatusCodeMustBe(HttpStatus.SC_OK);
thenTraceDataSizeMustBe(greaterThan(0));
thenTraceSpanSizeMustBe(greaterThan(1));
thenTraceSpanTagsSizeMustBe(greaterThan(0));
thenTraceSpansOperationNameMustBe(not(empty()));
thenCheckOperationNamesIsEqualTo(TRACE_PING_PATH);
thenCheckOperationNamesIsEqualTo(TRACE_PING_OPERATION_NAME);
});
}

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", "HTTP GET", "/hello" };
String operationName = "GET /ping/pong";
String[] operations = new String[] { "GET /ping/pong", "GET", "GET /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 @@ -122,7 +122,7 @@ public void verifyRollbackForNarayanaProgrammaticApproach() {
@Tag("QUARKUS-2492")
@Test
public void smokeTestNarayanaProgrammaticTransactionTrace() {
String operationName = "/transfer/accounts/{account_id}";
String operationName = "GET /transfer/accounts/{account_id}";
given().get("/transfer/accounts/" + ACCOUNT_NUMBER_LUIS).then().statusCode(HttpStatus.SC_OK);
verifyRestRequestTraces(operationName);
}
Expand Down

0 comments on commit f7a59f9

Please sign in to comment.