From f35c2f1370b0b1e4423ebcfa3afb7b30aff1d34c Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 31 Jan 2024 12:35:06 -0800 Subject: [PATCH 01/10] Always capture client.address --- ...actor.java => HttpServerAddressAndPortExtractor.java} | 9 ++++++--- .../http/HttpServerAttributesExtractorBuilder.java | 2 +- ...t.java => HttpServerAddressAndPortExtractorTest.java} | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) rename instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/{ForwardedForAddressAndPortExtractor.java => HttpServerAddressAndPortExtractor.java} (91%) rename instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/semconv/http/{ForwardedForAddressAndPortExtractorTest.java => HttpServerAddressAndPortExtractorTest.java} (98%) 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 91% 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..fea84399b78f 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,10 @@ public void extract(AddressPortSink sink, REQUEST request) { return; } } + + // use network.peer.address and network.peer.port + sink.setAddress(getter.getNetworkPeerAddress(request, null)); + sink.setPort(getter.getNetworkPeerPort(request, null)); } 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) From 1989a36c8d55ddf1051ca6f0c571ab904af63192 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 31 Jan 2024 13:15:13 -0800 Subject: [PATCH 02/10] Add test --- .../groovy/io/opentelemetry/smoketest/AppServerTest.groovy | 3 +++ 1 file changed, 3 insertions(+) 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 From 0408c59c339ed58f3d51f3800948435438bfbd5e Mon Sep 17 00:00:00 2001 From: heyams Date: Wed, 31 Jan 2024 15:17:59 -0800 Subject: [PATCH 03/10] Fix tests --- .../api/semconv/http/HttpServerAddressAndPortExtractor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAddressAndPortExtractor.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAddressAndPortExtractor.java index fea84399b78f..a5d075e3d2c5 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAddressAndPortExtractor.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAddressAndPortExtractor.java @@ -36,7 +36,10 @@ public void extract(AddressPortSink sink, REQUEST request) { // use network.peer.address and network.peer.port sink.setAddress(getter.getNetworkPeerAddress(request, null)); - sink.setPort(getter.getNetworkPeerPort(request, null)); + Integer port = getter.getNetworkPeerPort(request, null); + if (port != null && port > 0) { + sink.setPort(port); + } } private static boolean extractFromForwardedHeader(AddressPortSink sink, String forwarded) { From 335dd3263030a4d01ca4afc2cbdbed3a9b316d98 Mon Sep 17 00:00:00 2001 From: heyams Date: Thu, 1 Feb 2024 09:24:31 -0800 Subject: [PATCH 04/10] Fix tests --- .../test/groovy/JspInstrumentationBasicTests.groovy | 9 +++++++++ .../spring/webflux/v5_0/server/SpringWebfluxTest.java | 11 +++++++++++ 2 files changed, 20 insertions(+) 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/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"), From dd3c127b5b2a0e878791813247645be8cc2e6c27 Mon Sep 17 00:00:00 2001 From: heyams Date: Thu, 1 Feb 2024 09:52:05 -0800 Subject: [PATCH 05/10] Fix --- .../src/test/groovy/JspInstrumentationForwardTests.groovy | 6 ++++++ .../ratpack/server/AbstractRatpackRoutesTest.groovy | 1 + 2 files changed, 7 insertions(+) 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" From 5733437ea082a15dad632d9daee33bb4721e2edf Mon Sep 17 00:00:00 2001 From: heyams Date: Thu, 1 Feb 2024 10:46:51 -0800 Subject: [PATCH 06/10] Fix --- .../version35Test/groovy/VertxReactivePropagationTest.groovy | 2 ++ 1 file changed, 2 insertions(+) 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" From 1bbf768c25c882cc08d9c79547fb8eae89f1c30e Mon Sep 17 00:00:00 2001 From: heyams Date: Thu, 1 Feb 2024 14:49:13 -0800 Subject: [PATCH 07/10] Fix spark-2.3 test --- .../javaagent/instrumentation/sparkjava/SparkJavaBasedTest.java | 1 + 1 file changed, 1 insertion(+) 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, From 55344de94c1b7e7f48686c42f0a0a07e44bb5551 Mon Sep 17 00:00:00 2001 From: heyams Date: Fri, 2 Feb 2024 10:59:47 -0800 Subject: [PATCH 08/10] Fix TwoServicesWithDirectClientCamelTest --- .../apachecamel/TwoServicesWithDirectClientCamelTest.java | 1 + 1 file changed, 1 insertion(+) 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, From 713b29e82226a6e6554f7e1486a19d4ca421dfcb Mon Sep 17 00:00:00 2001 From: heyams Date: Fri, 2 Feb 2024 11:01:41 -0800 Subject: [PATCH 09/10] Fix RestCamelTest --- .../javaagent/instrumentation/apachecamel/RestCamelTest.java | 1 + 1 file changed, 1 insertion(+) 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, From e91aa762e4321c4cb6c4d0ea5a0fa30dbb2db2bd Mon Sep 17 00:00:00 2001 From: heyams Date: Fri, 2 Feb 2024 13:46:59 -0800 Subject: [PATCH 10/10] Fix vertxReactivePropagation tests --- .../latestDepTest/groovy/VertxReactivePropagationTest.groovy | 2 ++ 1 file changed, 2 insertions(+) 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"