Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OpenTelemetry REST client operation names as they changed upstream #1724

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import static org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase;

import java.time.Duration;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;

import org.apache.http.HttpStatus;
Expand Down Expand Up @@ -53,14 +54,19 @@ public class OpentelemetryReactiveIT {
public void testContextPropagation() {
int pageLimit = 10;
String operationName = "GET /ping/pong";
String[] operations = new String[] { "GET /ping/pong", "GET", "GET /hello" };
String[] operations = new String[] { "GET /ping/pong", "GET /hello", "GET /hello" };

await().atMost(1, TimeUnit.MINUTES).pollInterval(Duration.ofSeconds(1)).untilAsserted(() -> {
whenDoPingPongRequest();
thenRetrieveTraces(pageLimit, "1h", OTEL_PING_SERVICE_NAME, operationName);
thenTriggeredOperationsMustBe(containsInAnyOrder(operations));
thenTraceSpanSizeMustBe(is(3)); // 2 endpoint's + rest client call
verifyStandardSourceCodeAttributesArePresent(operationName);
ArrayList<String> spanKinds = resp.body().path(
"data[0].spans.findAll { it.operationName == '%s' }.tags.flatten().findAll { it.key == 'span.kind' }.value.flatten()",
"GET /hello");
Assertions.assertTrue(spanKinds.contains("client"));
Assertions.assertTrue(spanKinds.contains("server"));
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.time.Duration;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.http.HttpStatus;
import org.hamcrest.Matcher;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -58,14 +60,20 @@ public class OpenTelemetryIT {
public void testContextPropagation() {
int pageLimit = 10;
String operationName = "GET /ping/pong";
String[] operations = new String[] { "GET /ping/pong", "GET", "GET /hello" };
String[] operations = new String[] { "GET /ping/pong", "GET /hello", "GET /hello" };
gtroitsk marked this conversation as resolved.
Show resolved Hide resolved

await().atMost(1, TimeUnit.MINUTES).pollInterval(Duration.ofSeconds(1)).untilAsserted(() -> {
whenDoPingPongRequest();
thenRetrieveTraces(pageLimit, "1h", pingservice.getName(), operationName);
thenTriggeredOperationsMustBe(containsInAnyOrder(operations));
thenTraceSpanSizeMustBe(is(3)); // 2 endpoint's + rest client call
verifyStandardSourceCodeAttributesArePresent(operationName);

ArrayList<String> spanKinds = resp.body().path(
"data[0].spans.findAll { it.operationName == '%s' }.tags.flatten().findAll { it.key == 'span.kind' }.value.flatten()",
"GET /hello");
Assertions.assertTrue(spanKinds.contains("client"));
Assertions.assertTrue(spanKinds.contains("server"));
});
}

Expand Down