diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/ForwardedForAddressAndPortExtractor.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAddressAndPortExtractor.java similarity index 89% rename from instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/ForwardedForAddressAndPortExtractor.java rename to instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAddressAndPortExtractor.java index de16e9186266..a5d075e3d2c5 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/ForwardedForAddressAndPortExtractor.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAddressAndPortExtractor.java @@ -10,12 +10,11 @@ import io.opentelemetry.instrumentation.api.semconv.network.internal.AddressAndPortExtractor; import java.util.Locale; -final class ForwardedForAddressAndPortExtractor - implements AddressAndPortExtractor { +final class HttpServerAddressAndPortExtractor implements AddressAndPortExtractor { private final HttpServerAttributesGetter getter; - ForwardedForAddressAndPortExtractor(HttpServerAttributesGetter getter) { + HttpServerAddressAndPortExtractor(HttpServerAttributesGetter getter) { this.getter = getter; } @@ -34,6 +33,13 @@ public void extract(AddressPortSink sink, REQUEST request) { return; } } + + // use network.peer.address and network.peer.port + sink.setAddress(getter.getNetworkPeerAddress(request, null)); + Integer port = getter.getNetworkPeerPort(request, null); + if (port != null && port > 0) { + sink.setPort(port); + } } private static boolean extractFromForwardedHeader(AddressPortSink sink, String forwarded) { diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAttributesExtractorBuilder.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAttributesExtractorBuilder.java index cd437e9e0656..9eec4966d8d0 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAttributesExtractorBuilder.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAttributesExtractorBuilder.java @@ -46,7 +46,7 @@ public final class HttpServerAttributesExtractorBuilder { clientAddressPortExtractor = new ClientAddressAndPortExtractor<>( - httpAttributesGetter, new ForwardedForAddressAndPortExtractor<>(httpAttributesGetter)); + httpAttributesGetter, new HttpServerAddressAndPortExtractor<>(httpAttributesGetter)); serverAddressPortExtractor = new ForwardedHostAddressAndPortExtractor<>(httpAttributesGetter); } diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/semconv/http/ForwardedForAddressAndPortExtractorTest.java b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAddressAndPortExtractorTest.java similarity index 98% rename from instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/semconv/http/ForwardedForAddressAndPortExtractorTest.java rename to instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAddressAndPortExtractorTest.java index b0d1ea06a8d7..6388c04d4e3b 100644 --- a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/semconv/http/ForwardedForAddressAndPortExtractorTest.java +++ b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAddressAndPortExtractorTest.java @@ -27,11 +27,11 @@ import org.mockito.junit.jupiter.MockitoExtension; @ExtendWith(MockitoExtension.class) -class ForwardedForAddressAndPortExtractorTest { +class HttpServerAddressAndPortExtractorTest { @Mock HttpServerAttributesGetter getter; - @InjectMocks ForwardedForAddressAndPortExtractor underTest; + @InjectMocks HttpServerAddressAndPortExtractor underTest; @ParameterizedTest @ArgumentsSource(ForwardedArgs.class) diff --git a/instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/RestCamelTest.java b/instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/RestCamelTest.java index a76c3160c182..09c552ba2628 100644 --- a/instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/RestCamelTest.java +++ b/instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/RestCamelTest.java @@ -106,6 +106,7 @@ void restComponentServerAndClientCallWithJettyBackend() { equalTo(SemanticAttributes.NETWORK_PROTOCOL_VERSION, "1.1"), equalTo(SemanticAttributes.SERVER_ADDRESS, "localhost"), equalTo(SemanticAttributes.SERVER_PORT, Long.valueOf(port)), + equalTo(SemanticAttributes.CLIENT_ADDRESS, "127.0.0.1"), equalTo(NetworkAttributes.NETWORK_PEER_ADDRESS, "127.0.0.1"), satisfies( SemanticAttributes.USER_AGENT_ORIGINAL, diff --git a/instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/TwoServicesWithDirectClientCamelTest.java b/instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/TwoServicesWithDirectClientCamelTest.java index 0802fdafb3bd..d0001556120f 100644 --- a/instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/TwoServicesWithDirectClientCamelTest.java +++ b/instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/TwoServicesWithDirectClientCamelTest.java @@ -157,6 +157,7 @@ void twoCamelServiceSpans() throws Exception { equalTo(SemanticAttributes.NETWORK_PROTOCOL_VERSION, "1.1"), equalTo(SemanticAttributes.SERVER_ADDRESS, "127.0.0.1"), equalTo(SemanticAttributes.SERVER_PORT, portTwo), + equalTo(SemanticAttributes.CLIENT_ADDRESS, "127.0.0.1"), equalTo(NetworkAttributes.NETWORK_PEER_ADDRESS, "127.0.0.1"), satisfies( NetworkAttributes.NETWORK_PEER_PORT, diff --git a/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationBasicTests.groovy b/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationBasicTests.groovy index d990fe4f5007..05b1019d157e 100644 --- a/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationBasicTests.groovy +++ b/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationBasicTests.groovy @@ -99,6 +99,7 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" port + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_PORT" Long } @@ -156,6 +157,7 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" port + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_PORT" Long } @@ -208,7 +210,9 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" port + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" + "$NetworkAttributes.NETWORK_PEER_PORT" Long } } @@ -269,6 +273,7 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" port + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_PORT" Long "$SemanticAttributes.ERROR_TYPE" "500" @@ -336,6 +341,7 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" port + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_PORT" Long } @@ -383,6 +389,7 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" port + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_PORT" Long } @@ -462,6 +469,7 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" port + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_PORT" Long "$SemanticAttributes.ERROR_TYPE" "500" @@ -511,6 +519,7 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" port + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_PORT" Long } diff --git a/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationForwardTests.groovy b/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationForwardTests.groovy index e9aa38019c95..50a7cb69e303 100644 --- a/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationForwardTests.groovy +++ b/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationForwardTests.groovy @@ -97,6 +97,7 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" port + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_PORT" Long } @@ -165,6 +166,7 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" port + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_PORT" Long } @@ -212,6 +214,7 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" port + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_PORT" Long } @@ -307,6 +310,7 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" port + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_PORT" Long } @@ -388,6 +392,7 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" port + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_PORT" Long "$SemanticAttributes.ERROR_TYPE" "500" @@ -449,6 +454,7 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" port + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" "$NetworkAttributes.NETWORK_PEER_PORT" Long } diff --git a/instrumentation/ratpack/ratpack-1.4/testing/src/main/groovy/io/opentelemetry/instrumentation/ratpack/server/AbstractRatpackRoutesTest.groovy b/instrumentation/ratpack/ratpack-1.4/testing/src/main/groovy/io/opentelemetry/instrumentation/ratpack/server/AbstractRatpackRoutesTest.groovy index d7c88070ec3e..ae3b74294da7 100644 --- a/instrumentation/ratpack/ratpack-1.4/testing/src/main/groovy/io/opentelemetry/instrumentation/ratpack/server/AbstractRatpackRoutesTest.groovy +++ b/instrumentation/ratpack/ratpack-1.4/testing/src/main/groovy/io/opentelemetry/instrumentation/ratpack/server/AbstractRatpackRoutesTest.groovy @@ -98,6 +98,7 @@ abstract class AbstractRatpackRoutesTest extends InstrumentationSpecification { "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" "$SemanticAttributes.SERVER_ADDRESS" { it == "localhost" || it == null } "$SemanticAttributes.SERVER_PORT" { it == app.bindPort || it == null } + "$SemanticAttributes.CLIENT_ADDRESS" { it == "127.0.0.1" || it == null } "$NetworkAttributes.NETWORK_PEER_ADDRESS" { it == "127.0.0.1" || it == null } "$NetworkAttributes.NETWORK_PEER_PORT" { it instanceof Long || it == null } "$SemanticAttributes.HTTP_REQUEST_METHOD" "GET" diff --git a/instrumentation/spark-2.3/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/sparkjava/SparkJavaBasedTest.java b/instrumentation/spark-2.3/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/sparkjava/SparkJavaBasedTest.java index 5f053ff1b8a1..c637c5a3e2dd 100644 --- a/instrumentation/spark-2.3/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/sparkjava/SparkJavaBasedTest.java +++ b/instrumentation/spark-2.3/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/sparkjava/SparkJavaBasedTest.java @@ -71,6 +71,7 @@ void generatesSpans() { equalTo(SemanticAttributes.NETWORK_PROTOCOL_VERSION, "1.1"), equalTo(SemanticAttributes.SERVER_ADDRESS, "localhost"), equalTo(SemanticAttributes.SERVER_PORT, port), + equalTo(SemanticAttributes.CLIENT_ADDRESS, "127.0.0.1"), equalTo(NetworkAttributes.NETWORK_PEER_ADDRESS, "127.0.0.1"), satisfies( NetworkAttributes.NETWORK_PEER_PORT, diff --git a/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/server/SpringWebfluxTest.java b/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/server/SpringWebfluxTest.java index f2b4c7e45c3f..199724a53983 100644 --- a/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/server/SpringWebfluxTest.java +++ b/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/server/SpringWebfluxTest.java @@ -9,6 +9,7 @@ import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; +import static io.opentelemetry.semconv.SemanticAttributes.CLIENT_ADDRESS; import static io.opentelemetry.semconv.SemanticAttributes.ERROR_TYPE; import static io.opentelemetry.semconv.SemanticAttributes.EXCEPTION_EVENT_NAME; import static io.opentelemetry.semconv.SemanticAttributes.EXCEPTION_MESSAGE; @@ -119,6 +120,7 @@ void basicGetTest(Parameter parameter) { val -> val.isInstanceOf(Long.class)), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, val -> val.isInstanceOf(Long.class)), + equalTo(CLIENT_ADDRESS, "127.0.0.1"), equalTo(URL_PATH, parameter.urlPath), equalTo(HTTP_REQUEST_METHOD, "GET"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), @@ -239,6 +241,7 @@ void getAsyncResponseTest(Parameter parameter) { val -> val.isInstanceOf(Long.class)), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, val -> val.isInstanceOf(Long.class)), + equalTo(CLIENT_ADDRESS, "127.0.0.1"), equalTo(URL_PATH, parameter.urlPath), equalTo(HTTP_REQUEST_METHOD, "GET"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), @@ -346,6 +349,7 @@ void createSpanDuringHandlerFunctionTest(Parameter parameter) { val -> val.isInstanceOf(Long.class)), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, val -> val.isInstanceOf(Long.class)), + equalTo(CLIENT_ADDRESS, "127.0.0.1"), equalTo(URL_PATH, parameter.urlPath), equalTo(HTTP_REQUEST_METHOD, "GET"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), @@ -418,6 +422,7 @@ void get404Test() { val -> val.isInstanceOf(Long.class)), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, val -> val.isInstanceOf(Long.class)), + equalTo(CLIENT_ADDRESS, "127.0.0.1"), equalTo(URL_PATH, "/notfoundgreet"), equalTo(HTTP_REQUEST_METHOD, "GET"), equalTo(HTTP_RESPONSE_STATUS_CODE, 404), @@ -478,6 +483,7 @@ void basicPostTest() { val -> val.isInstanceOf(Long.class)), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, val -> val.isInstanceOf(Long.class)), + equalTo(CLIENT_ADDRESS, "127.0.0.1"), equalTo(URL_PATH, "/echo"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 202), @@ -518,6 +524,7 @@ void getToBadEndpointTest(Parameter parameter) { val -> val.isInstanceOf(Long.class)), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, val -> val.isInstanceOf(Long.class)), + equalTo(CLIENT_ADDRESS, "127.0.0.1"), equalTo(URL_PATH, parameter.urlPath), equalTo(HTTP_REQUEST_METHOD, "GET"), equalTo(HTTP_RESPONSE_STATUS_CODE, 500), @@ -598,6 +605,7 @@ void redirectTest() { val -> val.isInstanceOf(Long.class)), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, val -> val.isInstanceOf(Long.class)), + equalTo(CLIENT_ADDRESS, "127.0.0.1"), equalTo(URL_PATH, "/double-greet-redirect"), equalTo(HTTP_REQUEST_METHOD, "GET"), equalTo(HTTP_RESPONSE_STATUS_CODE, 307), @@ -626,6 +634,7 @@ void redirectTest() { val -> val.isInstanceOf(Long.class)), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, val -> val.isInstanceOf(Long.class)), + equalTo(CLIENT_ADDRESS, "127.0.0.1"), equalTo(URL_PATH, "/double-greet"), equalTo(HTTP_REQUEST_METHOD, "GET"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), @@ -677,6 +686,7 @@ void multipleGetsToDelayingRoute(Parameter parameter) { val -> val.isInstanceOf(Long.class)), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, val -> val.isInstanceOf(Long.class)), + equalTo(CLIENT_ADDRESS, "127.0.0.1"), equalTo(URL_PATH, parameter.urlPath), equalTo(HTTP_REQUEST_METHOD, "GET"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), @@ -758,6 +768,7 @@ void cancelRequestTest() throws Exception { val -> val.isInstanceOf(Long.class)), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, val -> val.isInstanceOf(Long.class)), + equalTo(CLIENT_ADDRESS, "127.0.0.1"), equalTo(URL_PATH, "/slow"), equalTo(HTTP_REQUEST_METHOD, "GET"), equalTo(URL_SCHEME, "http"), diff --git a/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/latestDepTest/groovy/VertxReactivePropagationTest.groovy b/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/latestDepTest/groovy/VertxReactivePropagationTest.groovy index a9cccd42395d..441c30f9e69a 100644 --- a/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/latestDepTest/groovy/VertxReactivePropagationTest.groovy +++ b/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/latestDepTest/groovy/VertxReactivePropagationTest.groovy @@ -68,6 +68,7 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification { "$NetworkAttributes.NETWORK_PEER_PORT" Long "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" Long + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$SemanticAttributes.URL_PATH" "/listProducts" "$SemanticAttributes.HTTP_REQUEST_METHOD" "GET" "$SemanticAttributes.HTTP_RESPONSE_STATUS_CODE" 200 @@ -158,6 +159,7 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification { "$NetworkAttributes.NETWORK_PEER_PORT" Long "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" Long + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$SemanticAttributes.URL_PATH" baseUrl "$SemanticAttributes.URL_QUERY" "$TEST_REQUEST_ID_PARAMETER=$requestId" "$SemanticAttributes.HTTP_REQUEST_METHOD" "GET" diff --git a/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version35Test/groovy/VertxReactivePropagationTest.groovy b/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version35Test/groovy/VertxReactivePropagationTest.groovy index a9cccd42395d..441c30f9e69a 100644 --- a/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version35Test/groovy/VertxReactivePropagationTest.groovy +++ b/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version35Test/groovy/VertxReactivePropagationTest.groovy @@ -68,6 +68,7 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification { "$NetworkAttributes.NETWORK_PEER_PORT" Long "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" Long + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$SemanticAttributes.URL_PATH" "/listProducts" "$SemanticAttributes.HTTP_REQUEST_METHOD" "GET" "$SemanticAttributes.HTTP_RESPONSE_STATUS_CODE" 200 @@ -158,6 +159,7 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification { "$NetworkAttributes.NETWORK_PEER_PORT" Long "$SemanticAttributes.SERVER_ADDRESS" "localhost" "$SemanticAttributes.SERVER_PORT" Long + "$SemanticAttributes.CLIENT_ADDRESS" "127.0.0.1" "$SemanticAttributes.URL_PATH" baseUrl "$SemanticAttributes.URL_QUERY" "$TEST_REQUEST_ID_PARAMETER=$requestId" "$SemanticAttributes.HTTP_REQUEST_METHOD" "GET" diff --git a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/AppServerTest.groovy b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/AppServerTest.groovy index 81f23842bffa..efdf6dc3c003 100644 --- a/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/AppServerTest.groovy +++ b/smoke-tests/src/test/groovy/io/opentelemetry/smoketest/AppServerTest.groovy @@ -123,6 +123,9 @@ abstract class AppServerTest extends SmokeTest { and: "Server span for the remote call" traces.countFilteredAttributes(SemanticAttributes.URL_PATH.key, "/app/headers") == 1 + and: "Number of spans with client address" + traces.countFilteredAttributes(SemanticAttributes.CLIENT_ADDRESS.key, "127.0.0.1") == 1 + and: "Number of spans with http protocol version" traces.countFilteredAttributes(SemanticAttributes.NETWORK_PROTOCOL_VERSION.key, "1.1") == 3