From a96a2273d4beeb3a776b57b56ec48901682dbc7c Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 2 Feb 2022 13:14:41 -0800 Subject: [PATCH 1/3] Fix triggering of DNS lookup --- .../net/InetSocketAddressNetClientAttributesGetter.java | 3 --- .../net/InetSocketAddressNetServerAttributesGetter.java | 3 --- 2 files changed, 6 deletions(-) diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetter.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetter.java index 7975aa8630fb..019df5343b14 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetter.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetter.java @@ -29,9 +29,6 @@ public final String peerName(REQUEST request, @Nullable RESPONSE response) { if (address == null) { return null; } - if (address.getAddress() != null) { - return address.getAddress().getHostName(); - } return address.getHostString(); } diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetter.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetter.java index 92a286f37b5c..269286a9ee6d 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetter.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetServerAttributesGetter.java @@ -29,9 +29,6 @@ public final String peerName(REQUEST request) { if (address == null) { return null; } - if (address.getAddress() != null) { - return address.getAddress().getHostName(); - } return address.getHostString(); } From 32106ae21c82cdf986468e1ed001948e73b20719 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 2 Feb 2022 14:26:44 -0800 Subject: [PATCH 2/3] Update test --- .../src/test/groovy/Elasticsearch6TransportClientTest.groovy | 5 ----- 1 file changed, 5 deletions(-) diff --git a/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6TransportClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6TransportClientTest.groovy index 3fc76707ef40..26b182e3b3b1 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6TransportClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6TransportClientTest.groovy @@ -105,7 +105,6 @@ class Elasticsearch6TransportClientTest extends AbstractElasticsearchTransportCl kind CLIENT childOf(span(0)) attributes { - "$SemanticAttributes.NET_PEER_NAME" "localhost" "$SemanticAttributes.NET_PEER_IP" tcpPublishAddress.address "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" @@ -224,7 +223,6 @@ class Elasticsearch6TransportClientTest extends AbstractElasticsearchTransportCl name "CreateIndexAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" "localhost" "$SemanticAttributes.NET_PEER_IP" tcpPublishAddress.address "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" @@ -240,7 +238,6 @@ class Elasticsearch6TransportClientTest extends AbstractElasticsearchTransportCl name "GetAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" "localhost" "$SemanticAttributes.NET_PEER_IP" tcpPublishAddress.address "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" @@ -271,7 +268,6 @@ class Elasticsearch6TransportClientTest extends AbstractElasticsearchTransportCl name "IndexAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" "localhost" "$SemanticAttributes.NET_PEER_IP" tcpPublishAddress.address "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" @@ -293,7 +289,6 @@ class Elasticsearch6TransportClientTest extends AbstractElasticsearchTransportCl name "GetAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" "localhost" "$SemanticAttributes.NET_PEER_IP" tcpPublishAddress.address "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" From fcc97b58d6c626c5b7f07a7b102f1d7033f161c0 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 2 Feb 2022 16:01:18 -0800 Subject: [PATCH 3/3] Update test --- .../javaagent/src/test/groovy/Jedis40ClientTest.groovy | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/instrumentation/jedis/jedis-4.0/javaagent/src/test/groovy/Jedis40ClientTest.groovy b/instrumentation/jedis/jedis-4.0/javaagent/src/test/groovy/Jedis40ClientTest.groovy index bbcdce5b9f61..585f548b7d71 100644 --- a/instrumentation/jedis/jedis-4.0/javaagent/src/test/groovy/Jedis40ClientTest.groovy +++ b/instrumentation/jedis/jedis-4.0/javaagent/src/test/groovy/Jedis40ClientTest.groovy @@ -24,7 +24,7 @@ class Jedis40ClientTest extends AgentInstrumentationSpecification { def setupSpec() { redisServer.start() port = redisServer.getMappedPort(6379) - jedis = new Jedis("localhost", port) + jedis = new Jedis("127.0.0.1", port) } def cleanupSpec() { @@ -51,7 +51,6 @@ class Jedis40ClientTest extends AgentInstrumentationSpecification { "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET foo ?" "$SemanticAttributes.DB_OPERATION" "SET" - "$SemanticAttributes.NET_PEER_NAME" "localhost" "$SemanticAttributes.NET_PEER_PORT" port "$SemanticAttributes.NET_PEER_IP" "127.0.0.1" "$SemanticAttributes.NET_TRANSPORT" SemanticAttributes.NetTransportValues.IP_TCP @@ -78,7 +77,6 @@ class Jedis40ClientTest extends AgentInstrumentationSpecification { "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET foo ?" "$SemanticAttributes.DB_OPERATION" "SET" - "$SemanticAttributes.NET_PEER_NAME" "localhost" "$SemanticAttributes.NET_PEER_PORT" port "$SemanticAttributes.NET_PEER_IP" "127.0.0.1" "$SemanticAttributes.NET_TRANSPORT" SemanticAttributes.NetTransportValues.IP_TCP @@ -93,7 +91,6 @@ class Jedis40ClientTest extends AgentInstrumentationSpecification { "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "GET foo" "$SemanticAttributes.DB_OPERATION" "GET" - "$SemanticAttributes.NET_PEER_NAME" "localhost" "$SemanticAttributes.NET_PEER_PORT" port "$SemanticAttributes.NET_PEER_IP" "127.0.0.1" "$SemanticAttributes.NET_TRANSPORT" SemanticAttributes.NetTransportValues.IP_TCP @@ -120,7 +117,6 @@ class Jedis40ClientTest extends AgentInstrumentationSpecification { "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET foo ?" "$SemanticAttributes.DB_OPERATION" "SET" - "$SemanticAttributes.NET_PEER_NAME" "localhost" "$SemanticAttributes.NET_PEER_PORT" port "$SemanticAttributes.NET_PEER_IP" "127.0.0.1" "$SemanticAttributes.NET_TRANSPORT" SemanticAttributes.NetTransportValues.IP_TCP @@ -135,7 +131,6 @@ class Jedis40ClientTest extends AgentInstrumentationSpecification { "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "RANDOMKEY" "$SemanticAttributes.DB_OPERATION" "RANDOMKEY" - "$SemanticAttributes.NET_PEER_NAME" "localhost" "$SemanticAttributes.NET_PEER_PORT" port "$SemanticAttributes.NET_PEER_IP" "127.0.0.1" "$SemanticAttributes.NET_TRANSPORT" SemanticAttributes.NetTransportValues.IP_TCP