Fix server -> client reference
MODIFY
instrumentation/spring/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/SpringWebNetAttributesGetter.java
instrumentation/spring/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/SpringWebNetAttributesGetter.java
package io.opentelemetry.instrumentation.spring.web;
-import io.opentelemetry.instrumentation.api.instrumenter.net.NetServerAttributesGetter;
+import io.opentelemetry.instrumentation.api.instrumenter.net.NetClientAttributesGetter;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import javax.annotation.Nullable;
import org.springframework.http.HttpRequest;
+import org.springframework.http.client.ClientHttpResponse;
-final class SpringWebNetAttributesGetter implements NetServerAttributesGetter<HttpRequest> {
+final class SpringWebNetAttributesGetter
+ implements NetClientAttributesGetter<HttpRequest, ClientHttpResponse> {
@Override
- public String transport(HttpRequest httpRequest) {
+ public String transport(HttpRequest httpRequest, @Nullable ClientHttpResponse response) {
return SemanticAttributes.NetTransportValues.IP_TCP;
}
@Override
@Nullable
- public String peerName(HttpRequest httpRequest) {
+ public String peerName(HttpRequest httpRequest, @Nullable ClientHttpResponse response) {
return httpRequest.getURI().getHost();
}
@Override
- public Integer peerPort(HttpRequest httpRequest) {
+ public Integer peerPort(HttpRequest httpRequest, @Nullable ClientHttpResponse response) {
return httpRequest.getURI().getPort();
}
@Override
@Nullable
- public String peerIp(HttpRequest httpRequest) {
+ public String peerIp(HttpRequest httpRequest, @Nullable ClientHttpResponse response) {
return null;
}
}

MODIFY
instrumentation/spring/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/SpringWebTracingBuilder.java
instrumentation/spring/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/SpringWebTracingBuilder.java
@@ -14,7 +14,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttribut
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientMetrics;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanNameExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanStatusExtractor;
-import io.opentelemetry.instrumentation.api.instrumenter.net.NetServerAttributesExtractor;
+import io.opentelemetry.instrumentation.api.instrumenter.net.NetClientAttributesExtractor;
import java.util.ArrayList;
import java.util.List;
import org.springframework.http.HttpRequest;
@@ -71,7 +71,7 @@ public final class SpringWebTracingBuilder {
.setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributeGetter))
.addAttributesExtractor(
HttpClientAttributesExtractor.create(httpAttributeGetter, capturedHttpHeaders))
- .addAttributesExtractor(NetServerAttributesExtractor.create(netAttributesGetter))
+ .addAttributesExtractor(NetClientAttributesExtractor.create(netAttributesGetter))
.addAttributesExtractors(additionalExtractors)
.addRequestMetrics(HttpClientMetrics.get())
.newClientInstrumenter(HttpRequestSetter.INSTANCE);

Fix server -> client reference (#5396)