diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientPeerServiceAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientPeerServiceAttributesExtractor.java index b583c91baa9a..621c57ef4329 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientPeerServiceAttributesExtractor.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientPeerServiceAttributesExtractor.java @@ -10,6 +10,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.net.PeerServiceResolver; import io.opentelemetry.instrumentation.api.instrumenter.url.UrlParser; +import io.opentelemetry.instrumentation.api.internal.SemconvStability; import io.opentelemetry.semconv.SemanticAttributes; import java.util.function.Supplier; import javax.annotation.Nullable; @@ -47,6 +48,7 @@ HttpClientPeerServiceAttributesExtractor create( @Override public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) {} + @SuppressWarnings("deprecation") // old semconv @Override public void onEnd( AttributesBuilder attributes, @@ -64,7 +66,7 @@ public void onEnd( Integer serverPort = attributesGetter.getServerPort(request); Supplier pathSupplier = () -> getUrlPath(attributesGetter, request); String peerService = mapToPeerService(serverAddress, serverPort, pathSupplier); - if (peerService == null) { + if (peerService == null && SemconvStability.emitOldHttpSemconv()) { String serverSocketDomain = attributesGetter.getServerSocketDomain(request, response); Integer serverSocketPort = attributesGetter.getServerSocketPort(request, response); peerService = mapToPeerService(serverSocketDomain, serverSocketPort, null); diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java index 05d79725d736..969bcd0891d0 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java @@ -59,20 +59,20 @@ default String getNetworkType(REQUEST request, @Nullable RESPONSE response) { @Nullable @Override - default InetSocketAddress getNetworkPeerInetSocketAddress( + default InetSocketAddress getServerInetSocketAddress( REQUEST request, @Nullable RESPONSE response) { - return getServerInetSocketAddress(request, response); + return getNetworkPeerInetSocketAddress(request, response); } @Nullable @Override - default String getNetworkPeerAddress(REQUEST request, @Nullable RESPONSE response) { - return getServerSocketAddress(request, response); + default String getServerSocketAddress(REQUEST request, @Nullable RESPONSE response) { + return getNetworkPeerAddress(request, response); } @Nullable @Override - default Integer getNetworkPeerPort(REQUEST request, @Nullable RESPONSE response) { - return getServerSocketPort(request, response); + default Integer getServerSocketPort(REQUEST request, @Nullable RESPONSE response) { + return getNetworkPeerPort(request, response); } } diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesGetter.java index 0343c20aec23..73e5a5ab4d64 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesGetter.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesGetter.java @@ -65,39 +65,39 @@ default String getNetworkType(REQUEST request, @Nullable RESPONSE response) { @Nullable @Override - default InetSocketAddress getNetworkLocalInetSocketAddress( + default InetSocketAddress getServerInetSocketAddress( REQUEST request, @Nullable RESPONSE response) { - return getServerInetSocketAddress(request, response); + return getNetworkLocalInetSocketAddress(request, response); } @Nullable @Override - default String getNetworkLocalAddress(REQUEST request, @Nullable RESPONSE response) { - return getServerSocketAddress(request, response); + default String getServerSocketAddress(REQUEST request, @Nullable RESPONSE response) { + return getNetworkLocalAddress(request, response); } @Nullable @Override - default Integer getNetworkLocalPort(REQUEST request, @Nullable RESPONSE response) { - return getServerSocketPort(request, response); + default Integer getServerSocketPort(REQUEST request, @Nullable RESPONSE response) { + return getNetworkLocalPort(request, response); } @Nullable @Override - default InetSocketAddress getNetworkPeerInetSocketAddress( + default InetSocketAddress getClientInetSocketAddress( REQUEST request, @Nullable RESPONSE response) { - return getClientInetSocketAddress(request, response); + return getNetworkPeerInetSocketAddress(request, response); } @Nullable @Override - default String getNetworkPeerAddress(REQUEST request, @Nullable RESPONSE response) { - return getClientSocketAddress(request, response); + default String getClientSocketAddress(REQUEST request, @Nullable RESPONSE response) { + return getNetworkPeerAddress(request, response); } @Nullable @Override - default Integer getNetworkPeerPort(REQUEST request, @Nullable RESPONSE response) { - return getClientSocketPort(request, response); + default Integer getClientSocketPort(REQUEST request, @Nullable RESPONSE response) { + return getNetworkPeerPort(request, response); } } diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/PeerServiceAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/PeerServiceAttributesExtractor.java index bad87e614c2e..890425456582 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/PeerServiceAttributesExtractor.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/PeerServiceAttributesExtractor.java @@ -45,6 +45,7 @@ public static AttributesExtractor create( @Override public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) {} + @SuppressWarnings("deprecation") // old semconv @Override public void onEnd( AttributesBuilder attributes, diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/ClientAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/ClientAttributesGetter.java index 89b4dad2fc65..9a1f9ff9bf91 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/ClientAttributesGetter.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/ClientAttributesGetter.java @@ -38,14 +38,16 @@ default Integer getClientPort(REQUEST request) { return null; } - // TODO deprecate - /** * Returns an {@link InetSocketAddress} object representing the immediate client socket address. * *

Implementing this method is equivalent to implementing all of {@link * #getClientSocketAddress(Object, Object)} and {@link #getClientSocketPort(Object, Object)}. + * + * @deprecated Implement {@link NetworkAttributesGetter#getNetworkPeerInetSocketAddress(Object, + * Object)} instead. */ + @Deprecated @Nullable default InetSocketAddress getClientInetSocketAddress( REQUEST request, @Nullable RESPONSE response) { @@ -62,7 +64,11 @@ default InetSocketAddress getClientInetSocketAddress( * simply return {@code null}. If the instrumented library does not expose {@link * InetSocketAddress} in its API, you might want to implement this method instead of {@link * #getClientInetSocketAddress(Object, Object)}. + * + * @deprecated Implement {@link NetworkAttributesGetter#getNetworkPeerAddress(Object, Object)} + * instead. */ + @Deprecated @Nullable default String getClientSocketAddress(REQUEST request, @Nullable RESPONSE response) { return InetSocketAddressUtil.getIpAddress(getClientInetSocketAddress(request, response)); @@ -78,7 +84,11 @@ default String getClientSocketAddress(REQUEST request, @Nullable RESPONSE respon * simply return {@code null}. If the instrumented library does not expose {@link * InetSocketAddress} in its API, you might want to implement this method instead of {@link * #getClientInetSocketAddress(Object, Object)}. + * + * @deprecated Implement {@link NetworkAttributesGetter#getNetworkPeerPort(Object, Object)} + * instead. */ + @Deprecated @Nullable default Integer getClientSocketPort(REQUEST request, @Nullable RESPONSE response) { return InetSocketAddressUtil.getPort(getClientInetSocketAddress(request, response)); diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/ServerAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/ServerAttributesGetter.java index df24124d315a..18b777e469a6 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/ServerAttributesGetter.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/ServerAttributesGetter.java @@ -47,7 +47,12 @@ default Integer getServerPort(REQUEST request) { *

Implementing this method is equivalent to implementing all of {@link * #getServerSocketDomain(Object, Object)}, {@link #getServerSocketAddress(Object, Object)} and * {@link #getServerSocketPort(Object, Object)}. + * + * @deprecated Implement {@link NetworkAttributesGetter#getNetworkPeerInetSocketAddress(Object, + * Object)} or {@link NetworkAttributesGetter#getNetworkLocalInetSocketAddress(Object, + * Object)} instead. */ + @Deprecated @Nullable default InetSocketAddress getServerInetSocketAddress( REQUEST request, @Nullable RESPONSE response) { @@ -64,7 +69,10 @@ default InetSocketAddress getServerInetSocketAddress( * simply return {@code null}. If the instrumented library does not expose {@link * InetSocketAddress} in its API, you might want to implement this method instead of {@link * #getServerInetSocketAddress(Object, Object)}. + * + * @deprecated This method is deprecated and will be removed without replacement. */ + @Deprecated @Nullable default String getServerSocketDomain(REQUEST request, @Nullable RESPONSE response) { return InetSocketAddressUtil.getDomainName(getServerInetSocketAddress(request, response)); @@ -80,7 +88,11 @@ default String getServerSocketDomain(REQUEST request, @Nullable RESPONSE respons * simply return {@code null}. If the instrumented library does not expose {@link * InetSocketAddress} in its API, you might want to implement this method instead of {@link * #getServerInetSocketAddress(Object, Object)}. + * + * @deprecated Implement {@link NetworkAttributesGetter#getNetworkPeerAddress(Object, Object)} or + * {@link NetworkAttributesGetter#getNetworkLocalAddress(Object, Object)} instead. */ + @Deprecated @Nullable default String getServerSocketAddress(REQUEST request, @Nullable RESPONSE response) { return InetSocketAddressUtil.getIpAddress(getServerInetSocketAddress(request, response)); @@ -96,7 +108,11 @@ default String getServerSocketAddress(REQUEST request, @Nullable RESPONSE respon * simply return {@code null}. If the instrumented library does not expose {@link * InetSocketAddress} in its API, you might want to implement this method instead of {@link * #getServerInetSocketAddress(Object, Object)}. + * + * @deprecated Implement {@link NetworkAttributesGetter#getNetworkPeerPort(Object, Object)} or + * {@link NetworkAttributesGetter#getNetworkLocalPort(Object, Object)} instead. */ + @Deprecated @Nullable default Integer getServerSocketPort(REQUEST request, @Nullable RESPONSE response) { return InetSocketAddressUtil.getPort(getServerInetSocketAddress(request, response)); diff --git a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientPeerServiceAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientPeerServiceAttributesExtractorTest.java index ab08aca02e6a..47cbcc31590d 100644 --- a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientPeerServiceAttributesExtractorTest.java +++ b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientPeerServiceAttributesExtractorTest.java @@ -76,6 +76,7 @@ void shouldNotSetAnyValueIfPeerNameDoesNotMatch() { assertTrue(endAttributes.build().isEmpty()); } + @SuppressWarnings("deprecation") // old semconv @Test void shouldSetPeerNameIfItMatches() { // given @@ -106,6 +107,7 @@ void shouldSetPeerNameIfItMatches() { verify(httpAttributesExtractor, never()).getServerSocketDomain(any(), any()); } + @SuppressWarnings("deprecation") // old semconv @Test void shouldSetSockPeerNameIfItMatchesAndNoPeerNameProvided() { // given diff --git a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetterTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetterTest.java index 72341c84e7be..e53f7e56fe7d 100644 --- a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetterTest.java +++ b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetterTest.java @@ -38,7 +38,7 @@ public Integer getServerPort(InetSocketAddress request) { } @Override - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( InetSocketAddress request, InetSocketAddress response) { return response; } diff --git a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetterTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetterTest.java index c06874fc80de..a17a2d769de3 100644 --- a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetterTest.java +++ b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetterTest.java @@ -39,12 +39,14 @@ public Integer getServerPort(Addresses request) { } @Override - public InetSocketAddress getClientInetSocketAddress(Addresses request, Addresses response) { + public InetSocketAddress getNetworkPeerInetSocketAddress( + Addresses request, Addresses response) { return request.peer; } @Override - public InetSocketAddress getServerInetSocketAddress(Addresses request, Addresses response) { + public InetSocketAddress getNetworkLocalInetSocketAddress( + Addresses request, Addresses response) { return request.host; } } diff --git a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorTest.java index 79110451086c..79fbf5bdec9d 100644 --- a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorTest.java +++ b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorTest.java @@ -76,20 +76,12 @@ public String getSockFamily(Map request, Map res } @Override - public String getServerSocketDomain(Map request, Map response) { - // we only support the InetSocketAddress case here; nearly no instrumentations override this - // method anyway - return null; - } - - @Override - public String getServerSocketAddress( - Map request, Map response) { + public String getNetworkPeerAddress(Map request, Map response) { return response.get("sockPeerAddr"); } @Override - public Integer getServerSocketPort(Map request, Map response) { + public Integer getNetworkPeerPort(Map request, Map response) { String sockPeerPort = response.get("sockPeerPort"); return sockPeerPort == null ? null : Integer.valueOf(sockPeerPort); } diff --git a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorTest.java index e4d9b443dc1f..ac332991027c 100644 --- a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorTest.java +++ b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorTest.java @@ -75,25 +75,25 @@ public String getSockFamily(Map request) { } @Override - public String getClientSocketAddress(Map request, Void response) { + public String getNetworkPeerAddress(Map request, Void response) { return request.get("sockPeerAddr"); } @Override - public Integer getClientSocketPort(Map request, Void response) { + public Integer getNetworkPeerPort(Map request, Void response) { String sockPeerPort = request.get("sockPeerPort"); return sockPeerPort == null ? null : Integer.valueOf(sockPeerPort); } @Nullable @Override - public String getServerSocketAddress(Map request, Void response) { + public String getNetworkLocalAddress(Map request, Void response) { return request.get("sockHostAddr"); } @Nullable @Override - public Integer getServerSocketPort(Map request, Void response) { + public Integer getNetworkLocalPort(Map request, Void response) { String sockHostPort = request.get("sockHostPort"); return sockHostPort == null ? null : Integer.valueOf(sockHostPort); } diff --git a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/PeerServiceAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/PeerServiceAttributesExtractorTest.java index c1595b817b8f..cf5a10ed9678 100644 --- a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/PeerServiceAttributesExtractorTest.java +++ b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/PeerServiceAttributesExtractorTest.java @@ -77,6 +77,7 @@ void shouldNotSetAnyValueIfPeerNameDoesNotMatch() { } @Test + @SuppressWarnings("deprecation") // old semconv void shouldSetPeerNameIfItMatches() { // given Map peerServiceMapping = new HashMap<>(); @@ -105,6 +106,7 @@ void shouldSetPeerNameIfItMatches() { verify(netAttributesExtractor, never()).getServerSocketDomain(any(), any()); } + @SuppressWarnings("deprecation") // old semconv @Test void shouldSetSockPeerNameIfItMatchesAndNoPeerNameProvided() { diff --git a/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorBothSemconvTest.java b/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorBothSemconvTest.java index bde4b7d32f11..57c317f5242b 100644 --- a/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorBothSemconvTest.java +++ b/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorBothSemconvTest.java @@ -76,18 +76,12 @@ public String getSockFamily(Map request, Map res } @Override - public String getServerSocketDomain(Map request, Map response) { - return response.get("sockPeerName"); - } - - @Override - public String getServerSocketAddress( - Map request, Map response) { + public String getNetworkPeerAddress(Map request, Map response) { return response.get("sockPeerAddr"); } @Override - public Integer getServerSocketPort(Map request, Map response) { + public Integer getNetworkPeerPort(Map request, Map response) { String sockPeerPort = response.get("sockPeerPort"); return sockPeerPort == null ? null : Integer.valueOf(sockPeerPort); } diff --git a/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorBothSemconvTest.java b/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorBothSemconvTest.java index 7d938f131653..0ec785070170 100644 --- a/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorBothSemconvTest.java +++ b/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorBothSemconvTest.java @@ -75,25 +75,25 @@ public String getSockFamily(Map request) { } @Override - public String getClientSocketAddress(Map request, Void response) { + public String getNetworkPeerAddress(Map request, Void response) { return request.get("sockPeerAddr"); } @Override - public Integer getClientSocketPort(Map request, Void response) { + public Integer getNetworkPeerPort(Map request, Void response) { String sockPeerPort = request.get("sockPeerPort"); return sockPeerPort == null ? null : Integer.valueOf(sockPeerPort); } @Nullable @Override - public String getServerSocketAddress(Map request, Void response) { + public String getNetworkLocalAddress(Map request, Void response) { return request.get("sockHostAddr"); } @Nullable @Override - public Integer getServerSocketPort(Map request, Void response) { + public Integer getNetworkLocalPort(Map request, Void response) { String sockHostPort = request.get("sockHostPort"); return sockHostPort == null ? null : Integer.valueOf(sockHostPort); } diff --git a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorStableSemconvTest.java b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorStableSemconvTest.java index 65f0c7311e8a..ee6d78dab425 100644 --- a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorStableSemconvTest.java +++ b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractorStableSemconvTest.java @@ -76,13 +76,12 @@ public String getSockFamily(Map request, Map res } @Override - public String getServerSocketAddress( - Map request, Map response) { + public String getNetworkPeerAddress(Map request, Map response) { return response.get("sockPeerAddr"); } @Override - public Integer getServerSocketPort(Map request, Map response) { + public Integer getNetworkPeerPort(Map request, Map response) { String sockPeerPort = response.get("sockPeerPort"); return sockPeerPort == null ? null : Integer.valueOf(sockPeerPort); } diff --git a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorStableSemconvTest.java b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorStableSemconvTest.java index 9259e911151b..38bc5b0eb0ce 100644 --- a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorStableSemconvTest.java +++ b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractorStableSemconvTest.java @@ -75,25 +75,25 @@ public String getSockFamily(Map request) { } @Override - public String getClientSocketAddress(Map request, Void response) { + public String getNetworkPeerAddress(Map request, Void response) { return request.get("sockPeerAddr"); } @Override - public Integer getClientSocketPort(Map request, Void response) { + public Integer getNetworkPeerPort(Map request, Void response) { String sockPeerPort = request.get("sockPeerPort"); return sockPeerPort == null ? null : Integer.valueOf(sockPeerPort); } @Nullable @Override - public String getServerSocketAddress(Map request, Void response) { + public String getNetworkLocalAddress(Map request, Void response) { return request.get("sockHostAddr"); } @Nullable @Override - public Integer getServerSocketPort(Map request, Void response) { + public Integer getNetworkLocalPort(Map request, Void response) { String sockHostPort = request.get("sockHostPort"); return sockHostPort == null ? null : Integer.valueOf(sockHostPort); } diff --git a/instrumentation-api/src/jmh/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBenchmark.java b/instrumentation-api/src/jmh/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBenchmark.java index 1bca3dca20ab..0ebb434293bd 100644 --- a/instrumentation-api/src/jmh/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBenchmark.java +++ b/instrumentation-api/src/jmh/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBenchmark.java @@ -111,7 +111,8 @@ public Integer getServerPort(Void request) { } @Override - public InetSocketAddress getServerInetSocketAddress(Void request, @Nullable Void response) { + public InetSocketAddress getNetworkPeerInetSocketAddress( + Void request, @Nullable Void response) { return PEER_ADDRESS; } } diff --git a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientHttpAttributesGetter.java b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientHttpAttributesGetter.java index fc1d06f12445..e8d847939a8c 100644 --- a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientHttpAttributesGetter.java +++ b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientHttpAttributesGetter.java @@ -71,8 +71,8 @@ public Integer getServerPort(ApacheHttpClientRequest request) { @Nullable @Override - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( ApacheHttpClientRequest request, @Nullable HttpResponse response) { - return request.getServerSocketAddress(); + return request.getNetworkPeerAddress(); } } diff --git a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpClientRequest.java b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpClientRequest.java index 12421cce67cc..244e10c892a8 100644 --- a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpClientRequest.java +++ b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpClientRequest.java @@ -136,7 +136,7 @@ private static URI getCalculatedUri(HttpHost httpHost, URI uri) { } @Nullable - public InetSocketAddress getServerSocketAddress() { + public InetSocketAddress getNetworkPeerAddress() { if (target == null) { return null; } diff --git a/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientHttpAttributesGetter.java b/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientHttpAttributesGetter.java index 1917485722f5..e7ff02c260e4 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientHttpAttributesGetter.java +++ b/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientHttpAttributesGetter.java @@ -71,8 +71,8 @@ public Integer getServerPort(ApacheHttpClientRequest request) { @Nullable @Override - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( ApacheHttpClientRequest request, @Nullable HttpResponse response) { - return request.getServerSocketAddress(); + return request.getNetworkPeerAddress(); } } diff --git a/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientRequest.java b/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientRequest.java index b1d7c1808531..4d5a26746333 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientRequest.java +++ b/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientRequest.java @@ -126,7 +126,7 @@ private static URI getCalculatedUri(HttpHost httpHost, URI uri) { } @Nullable - public InetSocketAddress getServerSocketAddress() { + public InetSocketAddress getNetworkPeerAddress() { if (target == null) { return null; } diff --git a/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaHttpServerAttributesGetter.java b/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaHttpServerAttributesGetter.java index 7f8901563a6a..9de2e6ea50ef 100644 --- a/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaHttpServerAttributesGetter.java +++ b/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaHttpServerAttributesGetter.java @@ -103,14 +103,14 @@ public Integer getServerPort(RequestContext ctx) { @Override @Nullable - public InetSocketAddress getClientInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( RequestContext ctx, @Nullable RequestLog requestLog) { return RequestContextAccess.remoteAddress(ctx); } @Nullable @Override - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkLocalInetSocketAddress( RequestContext ctx, @Nullable RequestLog log) { return RequestContextAccess.localAddress(ctx); } diff --git a/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/internal/ArmeriaHttpClientAttributesGetter.java b/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/internal/ArmeriaHttpClientAttributesGetter.java index 035547992fe1..0d20977f9b40 100644 --- a/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/internal/ArmeriaHttpClientAttributesGetter.java +++ b/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/internal/ArmeriaHttpClientAttributesGetter.java @@ -110,7 +110,7 @@ public Integer getServerPort(RequestContext ctx) { @Override @Nullable - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( RequestContext ctx, @Nullable RequestLog requestLog) { return RequestContextAccess.remoteAddress(ctx); } diff --git a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientHttpAttributesGetter.java b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientHttpAttributesGetter.java index e5835554f7f9..00925cf39a80 100644 --- a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientHttpAttributesGetter.java +++ b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientHttpAttributesGetter.java @@ -93,7 +93,7 @@ public Integer getServerPort(RequestContext request) { @Override @Nullable - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( RequestContext request, @Nullable Response response) { if (response != null && response.getRemoteAddress() instanceof InetSocketAddress) { return (InetSocketAddress) response.getRemoteAddress(); diff --git a/instrumentation/grizzly-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/GrizzlyHttpAttributesGetter.java b/instrumentation/grizzly-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/GrizzlyHttpAttributesGetter.java index d9f5d55222ee..827d357bc70d 100644 --- a/instrumentation/grizzly-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/GrizzlyHttpAttributesGetter.java +++ b/instrumentation/grizzly-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/GrizzlyHttpAttributesGetter.java @@ -132,26 +132,26 @@ public Integer getServerPort(HttpRequestPacket request) { @Nullable @Override - public String getClientSocketAddress( + public String getNetworkPeerAddress( HttpRequestPacket request, @Nullable HttpResponsePacket response) { return request.getRemoteAddress(); } @Override - public Integer getClientSocketPort( + public Integer getNetworkPeerPort( HttpRequestPacket request, @Nullable HttpResponsePacket response) { return request.getRemotePort(); } @Nullable @Override - public String getServerSocketAddress( + public String getNetworkLocalAddress( HttpRequestPacket request, @Nullable HttpResponsePacket response) { return request.getLocalAddress(); } @Override - public Integer getServerSocketPort( + public Integer getNetworkLocalPort( HttpRequestPacket request, @Nullable HttpResponsePacket response) { return request.getLocalPort(); } diff --git a/instrumentation/ktor/ktor-1.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v1_0/KtorHttpServerAttributesGetter.kt b/instrumentation/ktor/ktor-1.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v1_0/KtorHttpServerAttributesGetter.kt index 2cb7f6c8d9be..a9f1c533869c 100644 --- a/instrumentation/ktor/ktor-1.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v1_0/KtorHttpServerAttributesGetter.kt +++ b/instrumentation/ktor/ktor-1.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v1_0/KtorHttpServerAttributesGetter.kt @@ -49,7 +49,7 @@ internal enum class KtorHttpServerAttributesGetter : override fun getNetworkProtocolVersion(request: ApplicationRequest, response: ApplicationResponse?): String? = if (request.httpVersion.startsWith("HTTP/")) request.httpVersion.substring("HTTP/".length) else null - override fun getClientSocketAddress(request: ApplicationRequest, response: ApplicationResponse?): String? { + override fun getNetworkPeerAddress(request: ApplicationRequest, response: ApplicationResponse?): String? { val remote = request.local.remoteHost if ("unknown" != remote && isIpAddress(remote)) { return remote diff --git a/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/server/KtorHttpServerAttributesGetter.kt b/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/server/KtorHttpServerAttributesGetter.kt index 8bb05aa50ba5..4caa85d0ad30 100644 --- a/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/server/KtorHttpServerAttributesGetter.kt +++ b/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/server/KtorHttpServerAttributesGetter.kt @@ -57,7 +57,7 @@ internal enum class KtorHttpServerAttributesGetter : return request.local.port } - override fun getClientSocketAddress(request: ApplicationRequest, response: ApplicationResponse?): String? { + override fun getNetworkPeerAddress(request: ApplicationRequest, response: ApplicationResponse?): String? { val remote = request.local.remoteHost if ("unknown" != remote && isIpAddress(remote)) { return remote diff --git a/instrumentation/liberty/liberty-dispatcher-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherHttpAttributesGetter.java b/instrumentation/liberty/liberty-dispatcher-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherHttpAttributesGetter.java index 933ed13d29ee..176c7ca65a06 100644 --- a/instrumentation/liberty/liberty-dispatcher-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherHttpAttributesGetter.java +++ b/instrumentation/liberty/liberty-dispatcher-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherHttpAttributesGetter.java @@ -89,24 +89,24 @@ public Integer getServerPort(LibertyRequest request) { @Override @Nullable - public String getClientSocketAddress(LibertyRequest request, @Nullable LibertyResponse response) { + public String getNetworkPeerAddress(LibertyRequest request, @Nullable LibertyResponse response) { return request.getClientSocketAddress(); } @Override - public Integer getClientSocketPort(LibertyRequest request, @Nullable LibertyResponse response) { + public Integer getNetworkPeerPort(LibertyRequest request, @Nullable LibertyResponse response) { return request.getClientSocketPort(); } @Nullable @Override - public String getServerSocketAddress(LibertyRequest request, @Nullable LibertyResponse response) { + public String getNetworkLocalAddress(LibertyRequest request, @Nullable LibertyResponse response) { return request.getServerSocketAddress(); } @Nullable @Override - public Integer getServerSocketPort(LibertyRequest request, @Nullable LibertyResponse response) { + public Integer getNetworkLocalPort(LibertyRequest request, @Nullable LibertyResponse response) { return request.getServerSocketPort(); } } diff --git a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyConnectHttpAttributesGetter.java b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyConnectHttpAttributesGetter.java index cc738ef28805..a5298f37d84f 100644 --- a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyConnectHttpAttributesGetter.java +++ b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyConnectHttpAttributesGetter.java @@ -86,7 +86,7 @@ public Integer getServerPort(NettyConnectionRequest request) { @Nullable @Override - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( NettyConnectionRequest request, @Nullable Channel channel) { if (channel == null) { return null; diff --git a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyHttpClientAttributesGetter.java b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyHttpClientAttributesGetter.java index 0c176395b75f..aa06a02eeb55 100644 --- a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyHttpClientAttributesGetter.java +++ b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyHttpClientAttributesGetter.java @@ -110,7 +110,7 @@ public Integer getServerPort(HttpRequestAndChannel requestAndChannel) { @Override @Nullable - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) { SocketAddress address = requestAndChannel.channel().getRemoteAddress(); if (address instanceof InetSocketAddress) { diff --git a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/NettyHttpServerAttributesGetter.java b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/NettyHttpServerAttributesGetter.java index 434c9509b35d..a71425be582d 100644 --- a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/NettyHttpServerAttributesGetter.java +++ b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/NettyHttpServerAttributesGetter.java @@ -105,7 +105,7 @@ public Integer getServerPort(HttpRequestAndChannel requestAndChannel) { @Override @Nullable - public InetSocketAddress getClientInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) { SocketAddress address = requestAndChannel.channel().getRemoteAddress(); if (address instanceof InetSocketAddress) { @@ -116,7 +116,7 @@ public InetSocketAddress getClientInetSocketAddress( @Nullable @Override - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkLocalInetSocketAddress( HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) { SocketAddress address = requestAndChannel.channel().getLocalAddress(); if (address instanceof InetSocketAddress) { diff --git a/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/client/NettyConnectHttpAttributesGetter.java b/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/client/NettyConnectHttpAttributesGetter.java index c866c3371bba..9ab8f8e795aa 100644 --- a/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/client/NettyConnectHttpAttributesGetter.java +++ b/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/client/NettyConnectHttpAttributesGetter.java @@ -86,7 +86,7 @@ public Integer getServerPort(NettyConnectionRequest request) { @Nullable @Override - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( NettyConnectionRequest request, @Nullable Channel channel) { if (channel == null) { return null; diff --git a/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/client/NettyHttpClientAttributesGetter.java b/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/client/NettyHttpClientAttributesGetter.java index a64629df0e87..8fa2d4c2b170 100644 --- a/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/client/NettyHttpClientAttributesGetter.java +++ b/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/client/NettyHttpClientAttributesGetter.java @@ -110,7 +110,7 @@ public Integer getServerPort(HttpRequestAndChannel requestAndChannel) { @Override @Nullable - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) { SocketAddress address = requestAndChannel.remoteAddress(); if (address instanceof InetSocketAddress) { diff --git a/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/client/NettySslNetAttributesGetter.java b/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/client/NettySslNetAttributesGetter.java index f222f02632a3..7ab3f2ddfb60 100644 --- a/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/client/NettySslNetAttributesGetter.java +++ b/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/client/NettySslNetAttributesGetter.java @@ -42,7 +42,7 @@ public Integer getServerPort(NettySslRequest nettySslRequest) { @Nullable @Override - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( NettySslRequest request, @Nullable Void unused) { if (request.remoteAddress() instanceof InetSocketAddress) { return (InetSocketAddress) request.remoteAddress(); diff --git a/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/server/NettyHttpServerAttributesGetter.java b/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/server/NettyHttpServerAttributesGetter.java index 5d04c6957edf..b9fde47717d6 100644 --- a/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/server/NettyHttpServerAttributesGetter.java +++ b/instrumentation/netty/netty-4-common/library/src/main/java/io/opentelemetry/instrumentation/netty/v4/common/internal/server/NettyHttpServerAttributesGetter.java @@ -105,7 +105,7 @@ public Integer getServerPort(HttpRequestAndChannel requestAndChannel) { @Override @Nullable - public InetSocketAddress getClientInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) { SocketAddress address = requestAndChannel.remoteAddress(); if (address instanceof InetSocketAddress) { @@ -116,7 +116,7 @@ public InetSocketAddress getClientInetSocketAddress( @Nullable @Override - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkLocalInetSocketAddress( HttpRequestAndChannel requestAndChannel, @Nullable HttpResponse response) { SocketAddress address = requestAndChannel.channel().localAddress(); if (address instanceof InetSocketAddress) { diff --git a/instrumentation/opensearch/opensearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opensearch/rest/OpenSearchRestNetResponseAttributesGetter.java b/instrumentation/opensearch/opensearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opensearch/rest/OpenSearchRestNetResponseAttributesGetter.java index 66af50f54d02..43d36bc868b2 100644 --- a/instrumentation/opensearch/opensearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opensearch/rest/OpenSearchRestNetResponseAttributesGetter.java +++ b/instrumentation/opensearch/opensearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opensearch/rest/OpenSearchRestNetResponseAttributesGetter.java @@ -55,7 +55,7 @@ public Integer getServerPort(OpenSearchRestRequest request) { @Override @Nullable - public String getServerSocketAddress(OpenSearchRestRequest request, @Nullable Response response) { + public String getNetworkPeerAddress(OpenSearchRestRequest request, @Nullable Response response) { if (response != null && response.getHost().getAddress() != null) { return response.getHost().getAddress().getHostAddress(); } diff --git a/instrumentation/play/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientHttpAttributesGetter.java b/instrumentation/play/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientHttpAttributesGetter.java index 017b6b46c612..87aadea1ad56 100644 --- a/instrumentation/play/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientHttpAttributesGetter.java +++ b/instrumentation/play/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientHttpAttributesGetter.java @@ -54,7 +54,7 @@ public Integer getServerPort(Request request) { @Override @Nullable - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( Request request, @Nullable Response response) { if (response != null && response.getRemoteAddress() instanceof InetSocketAddress) { return (InetSocketAddress) response.getRemoteAddress(); diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitChannelNetAttributesGetter.java b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitChannelNetAttributesGetter.java index 9cd04a538eb4..f459d5339bdc 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitChannelNetAttributesGetter.java +++ b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitChannelNetAttributesGetter.java @@ -50,12 +50,12 @@ public Integer getServerPort(ChannelAndMethod channelAndMethod) { @Nullable @Override - public String getServerSocketAddress(ChannelAndMethod channelAndMethod, @Nullable Void unused) { + public String getNetworkPeerAddress(ChannelAndMethod channelAndMethod, @Nullable Void unused) { return channelAndMethod.getChannel().getConnection().getAddress().getHostAddress(); } @Override - public Integer getServerSocketPort(ChannelAndMethod channelAndMethod, @Nullable Void unused) { + public Integer getNetworkPeerPort(ChannelAndMethod channelAndMethod, @Nullable Void unused) { return channelAndMethod.getChannel().getConnection().getPort(); } } diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitReceiveNetAttributesGetter.java b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitReceiveNetAttributesGetter.java index 28f10b3fd249..01f7868a04cc 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitReceiveNetAttributesGetter.java +++ b/instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitReceiveNetAttributesGetter.java @@ -51,13 +51,13 @@ public Integer getServerPort(ReceiveRequest request) { @Nullable @Override - public String getServerSocketAddress(ReceiveRequest request, @Nullable GetResponse response) { + public String getNetworkPeerAddress(ReceiveRequest request, @Nullable GetResponse response) { return request.getConnection().getAddress().getHostAddress(); } @Nullable @Override - public Integer getServerSocketPort(ReceiveRequest request, @Nullable GetResponse response) { + public Integer getNetworkPeerPort(ReceiveRequest request, @Nullable GetResponse response) { return request.getConnection().getPort(); } } diff --git a/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/v1_7/RatpackHttpAttributesGetter.java b/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/v1_7/RatpackHttpAttributesGetter.java index 1d28a2ae464b..7581db23cbf6 100644 --- a/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/v1_7/RatpackHttpAttributesGetter.java +++ b/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/v1_7/RatpackHttpAttributesGetter.java @@ -106,7 +106,7 @@ private static PublicAddress getPublicAddress(Request request) { } @Override - public Integer getClientSocketPort(Request request, @Nullable Response response) { + public Integer getNetworkPeerPort(Request request, @Nullable Response response) { return request.getRemoteAddress().getPort(); } } diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyHttpClientAttributesGetter.java b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyHttpClientAttributesGetter.java index 1b5fa61767be..9fdeab80b81f 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyHttpClientAttributesGetter.java +++ b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyHttpClientAttributesGetter.java @@ -83,7 +83,7 @@ public Integer getServerPort(HttpClientRequest request) { @Nullable @Override - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( HttpClientRequest request, @Nullable HttpClientResponse response) { // we're making use of the fact that HttpClientOperations is both a Connection and an diff --git a/instrumentation/restlet/restlet-1.1/library/src/main/java/io/opentelemetry/instrumentation/restlet/v1_1/RestletHttpAttributesGetter.java b/instrumentation/restlet/restlet-1.1/library/src/main/java/io/opentelemetry/instrumentation/restlet/v1_1/RestletHttpAttributesGetter.java index 9f22138153e9..48fa6bee0692 100644 --- a/instrumentation/restlet/restlet-1.1/library/src/main/java/io/opentelemetry/instrumentation/restlet/v1_1/RestletHttpAttributesGetter.java +++ b/instrumentation/restlet/restlet-1.1/library/src/main/java/io/opentelemetry/instrumentation/restlet/v1_1/RestletHttpAttributesGetter.java @@ -122,18 +122,18 @@ public Integer getServerPort(Request request) { @Override @Nullable - public String getClientSocketAddress(Request request, @Nullable Response response) { + public String getNetworkPeerAddress(Request request, @Nullable Response response) { return request.getClientInfo().getAddress(); } @Override - public Integer getClientSocketPort(Request request, @Nullable Response response) { + public Integer getNetworkPeerPort(Request request, @Nullable Response response) { return request.getClientInfo().getPort(); } @Nullable @Override - public String getServerSocketAddress(Request request, @Nullable Response response) { + public String getNetworkLocalAddress(Request request, @Nullable Response response) { HttpCall call = httpCall(request); return call == null ? null : call.getServerAddress(); } diff --git a/instrumentation/restlet/restlet-2.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v2_0/internal/RestletHttpAttributesGetter.java b/instrumentation/restlet/restlet-2.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v2_0/internal/RestletHttpAttributesGetter.java index 52babb249be1..008b0bdc04da 100644 --- a/instrumentation/restlet/restlet-2.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v2_0/internal/RestletHttpAttributesGetter.java +++ b/instrumentation/restlet/restlet-2.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v2_0/internal/RestletHttpAttributesGetter.java @@ -96,18 +96,18 @@ public Integer getServerPort(Request request) { @Override @Nullable - public String getClientSocketAddress(Request request, @Nullable Response response) { + public String getNetworkPeerAddress(Request request, @Nullable Response response) { return request.getClientInfo().getAddress(); } @Override - public Integer getClientSocketPort(Request request, @Nullable Response response) { + public Integer getNetworkPeerPort(Request request, @Nullable Response response) { return request.getClientInfo().getPort(); } @Nullable @Override - public String getServerSocketAddress(Request request, @Nullable Response response) { + public String getNetworkLocalAddress(Request request, @Nullable Response response) { return ServerCallAccess.getServerAddress(request); } } diff --git a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHttpAttributesGetter.java b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHttpAttributesGetter.java index a6499dce1daf..e25f7c2af2f9 100644 --- a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHttpAttributesGetter.java +++ b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHttpAttributesGetter.java @@ -120,7 +120,7 @@ public Integer getServerPort(ServletRequestContext requestContext) { @Override @Nullable - public String getClientSocketAddress( + public String getNetworkPeerAddress( ServletRequestContext requestContext, @Nullable ServletResponseContext response) { return accessor.getRequestRemoteAddr(requestContext.request()); @@ -128,7 +128,7 @@ public String getClientSocketAddress( @Override @Nullable - public Integer getClientSocketPort( + public Integer getNetworkPeerPort( ServletRequestContext requestContext, @Nullable ServletResponseContext response) { return accessor.getRequestRemotePort(requestContext.request()); @@ -136,7 +136,7 @@ public Integer getClientSocketPort( @Nullable @Override - public String getServerSocketAddress( + public String getNetworkLocalAddress( ServletRequestContext requestContext, @Nullable ServletResponseContext response) { return accessor.getRequestLocalAddr(requestContext.request()); @@ -144,7 +144,7 @@ public String getServerSocketAddress( @Nullable @Override - public Integer getServerSocketPort( + public Integer getNetworkLocalPort( ServletRequestContext requestContext, @Nullable ServletResponseContext response) { return accessor.getRequestLocalPort(requestContext.request()); diff --git a/instrumentation/spring/spring-webflux/spring-webflux-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/WebfluxServerHttpAttributesGetter.java b/instrumentation/spring/spring-webflux/spring-webflux-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/WebfluxServerHttpAttributesGetter.java index fdf79cbf3308..dcc78750dc49 100644 --- a/instrumentation/spring/spring-webflux/spring-webflux-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/WebfluxServerHttpAttributesGetter.java +++ b/instrumentation/spring/spring-webflux/spring-webflux-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/WebfluxServerHttpAttributesGetter.java @@ -94,14 +94,14 @@ public Integer getServerPort(ServerWebExchange request) { @Nullable @Override - public InetSocketAddress getClientInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( ServerWebExchange request, @Nullable ServerWebExchange response) { return request.getRequest().getRemoteAddress(); } @Nullable @Override - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkLocalInetSocketAddress( ServerWebExchange request, @Nullable ServerWebExchange response) { return request.getRequest().getLocalAddress(); } diff --git a/instrumentation/spring/spring-webmvc/spring-webmvc-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/v5_3/SpringWebMvcHttpAttributesGetter.java b/instrumentation/spring/spring-webmvc/spring-webmvc-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/v5_3/SpringWebMvcHttpAttributesGetter.java index 5acf91a8fa3e..9853a0fb446a 100644 --- a/instrumentation/spring/spring-webmvc/spring-webmvc-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/v5_3/SpringWebMvcHttpAttributesGetter.java +++ b/instrumentation/spring/spring-webmvc/spring-webmvc-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/v5_3/SpringWebMvcHttpAttributesGetter.java @@ -116,26 +116,26 @@ public Integer getServerPort(HttpServletRequest request) { @Override @Nullable - public String getClientSocketAddress( + public String getNetworkPeerAddress( HttpServletRequest request, @Nullable HttpServletResponse response) { return request.getRemoteAddr(); } @Override - public Integer getClientSocketPort( + public Integer getNetworkPeerPort( HttpServletRequest request, @Nullable HttpServletResponse response) { return request.getRemotePort(); } @Nullable @Override - public String getServerSocketAddress( + public String getNetworkLocalAddress( HttpServletRequest request, @Nullable HttpServletResponse response) { return request.getLocalAddr(); } @Override - public Integer getServerSocketPort( + public Integer getNetworkLocalPort( HttpServletRequest request, @Nullable HttpServletResponse respo) { return request.getLocalPort(); } diff --git a/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/v6_0/SpringWebMvcHttpAttributesGetter.java b/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/v6_0/SpringWebMvcHttpAttributesGetter.java index 797505beaec6..238769e13ad9 100644 --- a/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/v6_0/SpringWebMvcHttpAttributesGetter.java +++ b/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/v6_0/SpringWebMvcHttpAttributesGetter.java @@ -116,26 +116,26 @@ public Integer getServerPort(HttpServletRequest request) { @Override @Nullable - public String getClientSocketAddress( + public String getNetworkPeerAddress( HttpServletRequest request, @Nullable HttpServletResponse response) { return request.getRemoteAddr(); } @Override - public Integer getClientSocketPort( + public Integer getNetworkPeerPort( HttpServletRequest request, @Nullable HttpServletResponse response) { return request.getRemotePort(); } @Nullable @Override - public String getServerSocketAddress( + public String getNetworkLocalAddress( HttpServletRequest request, @Nullable HttpServletResponse response) { return request.getLocalAddr(); } @Override - public Integer getServerSocketPort( + public Integer getNetworkLocalPort( HttpServletRequest request, @Nullable HttpServletResponse response) { return request.getLocalPort(); } diff --git a/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatHttpAttributesGetter.java b/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatHttpAttributesGetter.java index 9a35d383e9b5..ff1e261ebebe 100644 --- a/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatHttpAttributesGetter.java +++ b/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatHttpAttributesGetter.java @@ -92,28 +92,28 @@ public Integer getServerPort(Request request) { @Override @Nullable - public String getClientSocketAddress(Request request, @Nullable Response response) { + public String getNetworkPeerAddress(Request request, @Nullable Response response) { request.action(ActionCode.REQ_HOST_ADDR_ATTRIBUTE, request); return messageBytesToString(request.remoteAddr()); } @Override @Nullable - public Integer getClientSocketPort(Request request, @Nullable Response response) { + public Integer getNetworkPeerPort(Request request, @Nullable Response response) { request.action(ActionCode.REQ_REMOTEPORT_ATTRIBUTE, request); return request.getRemotePort(); } @Nullable @Override - public String getServerSocketAddress(Request request, @Nullable Response response) { + public String getNetworkLocalAddress(Request request, @Nullable Response response) { request.action(ActionCode.REQ_LOCAL_ADDR_ATTRIBUTE, request); return messageBytesToString(request.localAddr()); } @Nullable @Override - public Integer getServerSocketPort(Request request, @Nullable Response response) { + public Integer getNetworkLocalPort(Request request, @Nullable Response response) { request.action(ActionCode.REQ_LOCALPORT_ATTRIBUTE, request); return request.getLocalPort(); } diff --git a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowHttpAttributesGetter.java b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowHttpAttributesGetter.java index d67ee2707300..139e2f591244 100644 --- a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowHttpAttributesGetter.java +++ b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowHttpAttributesGetter.java @@ -97,14 +97,14 @@ public Integer getServerPort(HttpServerExchange exchange) { @Override @Nullable - public InetSocketAddress getClientInetSocketAddress( + public InetSocketAddress getNetworkPeerInetSocketAddress( HttpServerExchange exchange, @Nullable HttpServerExchange unused) { return exchange.getConnection().getPeerAddress(InetSocketAddress.class); } @Nullable @Override - public InetSocketAddress getServerInetSocketAddress( + public InetSocketAddress getNetworkLocalInetSocketAddress( HttpServerExchange exchange, @Nullable HttpServerExchange unused) { return exchange.getConnection().getLocalAddress(InetSocketAddress.class); } diff --git a/instrumentation/vertx/vertx-http-client/vertx-http-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/client/Vertx4HttpAttributesGetter.java b/instrumentation/vertx/vertx-http-client/vertx-http-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/client/Vertx4HttpAttributesGetter.java index 3c0480bfbc75..a9c64e8cce75 100644 --- a/instrumentation/vertx/vertx-http-client/vertx-http-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/client/Vertx4HttpAttributesGetter.java +++ b/instrumentation/vertx/vertx-http-client/vertx-http-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/client/Vertx4HttpAttributesGetter.java @@ -70,7 +70,7 @@ public Integer getServerPort(HttpClientRequest request) { @Nullable @Override - public String getServerSocketAddress( + public String getNetworkPeerAddress( HttpClientRequest request, @Nullable HttpClientResponse response) { if (response == null) { return null; @@ -81,18 +81,7 @@ public String getServerSocketAddress( @Nullable @Override - public String getServerSocketDomain( - HttpClientRequest request, @Nullable HttpClientResponse response) { - if (response == null) { - return null; - } - SocketAddress socketAddress = response.netSocket().remoteAddress(); - return socketAddress == null ? null : socketAddress.host(); - } - - @Nullable - @Override - public Integer getServerSocketPort( + public Integer getNetworkPeerPort( HttpClientRequest request, @Nullable HttpClientResponse response) { if (response == null) { return null;