|
6 | 6 | package io.opentelemetry.instrumentation.spring.webflux.client; |
7 | 7 |
|
8 | 8 | import static io.opentelemetry.api.trace.SpanKind.CLIENT; |
| 9 | +import static io.opentelemetry.instrumentation.testing.junit.service.SemconvServiceStabilityUtil.maybeStablePeerService; |
9 | 10 | import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; |
10 | 11 | import static io.opentelemetry.semconv.ErrorAttributes.ERROR_TYPE; |
11 | 12 | import static io.opentelemetry.semconv.HttpAttributes.HTTP_REQUEST_METHOD; |
@@ -56,6 +57,8 @@ public WebClient.RequestBodySpec buildRequest( |
56 | 57 |
|
57 | 58 | protected abstract WebClient.Builder instrument(WebClient.Builder builder); |
58 | 59 |
|
| 60 | + protected abstract boolean hasServicePeerName(); |
| 61 | + |
59 | 62 | @Override |
60 | 63 | public int sendRequest( |
61 | 64 | WebClient.RequestBodySpec request, String method, URI uri, Map<String, String> headers) { |
@@ -199,11 +202,14 @@ void shouldEndSpanOnMonoTimeout() { |
199 | 202 | span.hasName("GET") |
200 | 203 | .hasKind(CLIENT) |
201 | 204 | .hasParent(trace.getSpan(0)) |
202 | | - .hasAttributesSatisfying( |
| 205 | + .hasAttributesSatisfyingExactly( |
203 | 206 | equalTo(HTTP_REQUEST_METHOD, "GET"), |
204 | 207 | equalTo(URL_FULL, uri.toString()), |
205 | 208 | equalTo(SERVER_ADDRESS, "localhost"), |
206 | 209 | equalTo(SERVER_PORT, uri.getPort()), |
| 210 | + equalTo( |
| 211 | + maybeStablePeerService(), |
| 212 | + hasServicePeerName() ? "test-peer-service" : null), |
207 | 213 | equalTo(ERROR_TYPE, "cancelled")), |
208 | 214 | span -> |
209 | 215 | span.hasName("test-http-server") |
|
0 commit comments