Skip to content

Commit 87092a6

Browse files
otelbot[bot]laurit
andauthored
Review fixes for spring-webflux-5.3:testing (open-telemetry#17750)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com> Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
1 parent 64857d2 commit 87092a6

4 files changed

Lines changed: 22 additions & 1 deletion

File tree

instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/client/SpringWebfluxClientInstrumentationTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ protected WebClient.Builder instrument(WebClient.Builder builder) {
2424
return builder;
2525
}
2626

27+
@Override
28+
protected boolean hasServicePeerName() {
29+
return true;
30+
}
31+
2732
@Override
2833
protected void configure(HttpClientTestOptions.Builder optionsBuilder) {
2934
super.configure(optionsBuilder);

instrumentation/spring/spring-webflux/spring-webflux-5.0/testing-webflux7/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v7_0/client/SpringWebfluxClientInstrumentationTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ protected WebClient.Builder instrument(WebClient.Builder builder) {
2424
return builder;
2525
}
2626

27+
@Override
28+
protected boolean hasServicePeerName() {
29+
return true;
30+
}
31+
2732
@Override
2833
protected void configure(HttpClientTestOptions.Builder optionsBuilder) {
2934
super.configure(optionsBuilder);

instrumentation/spring/spring-webflux/spring-webflux-5.3/library/src/test/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/SpringWebfluxClientInstrumentationTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,9 @@ protected WebClient.Builder instrument(WebClient.Builder builder) {
2929
.build();
3030
return builder.filters(instrumentation::addFilterAndRegisterReactorHook);
3131
}
32+
33+
@Override
34+
protected boolean hasServicePeerName() {
35+
return false;
36+
}
3237
}

instrumentation/spring/spring-webflux/spring-webflux-5.3/testing/src/main/java/io/opentelemetry/instrumentation/spring/webflux/client/AbstractSpringWebfluxClientInstrumentationTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package io.opentelemetry.instrumentation.spring.webflux.client;
77

88
import static io.opentelemetry.api.trace.SpanKind.CLIENT;
9+
import static io.opentelemetry.instrumentation.testing.junit.service.SemconvServiceStabilityUtil.maybeStablePeerService;
910
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
1011
import static io.opentelemetry.semconv.ErrorAttributes.ERROR_TYPE;
1112
import static io.opentelemetry.semconv.HttpAttributes.HTTP_REQUEST_METHOD;
@@ -56,6 +57,8 @@ public WebClient.RequestBodySpec buildRequest(
5657

5758
protected abstract WebClient.Builder instrument(WebClient.Builder builder);
5859

60+
protected abstract boolean hasServicePeerName();
61+
5962
@Override
6063
public int sendRequest(
6164
WebClient.RequestBodySpec request, String method, URI uri, Map<String, String> headers) {
@@ -199,11 +202,14 @@ void shouldEndSpanOnMonoTimeout() {
199202
span.hasName("GET")
200203
.hasKind(CLIENT)
201204
.hasParent(trace.getSpan(0))
202-
.hasAttributesSatisfying(
205+
.hasAttributesSatisfyingExactly(
203206
equalTo(HTTP_REQUEST_METHOD, "GET"),
204207
equalTo(URL_FULL, uri.toString()),
205208
equalTo(SERVER_ADDRESS, "localhost"),
206209
equalTo(SERVER_PORT, uri.getPort()),
210+
equalTo(
211+
maybeStablePeerService(),
212+
hasServicePeerName() ? "test-peer-service" : null),
207213
equalTo(ERROR_TYPE, "cancelled")),
208214
span ->
209215
span.hasName("test-http-server")

0 commit comments

Comments
 (0)