From b3285ad7847dad1bc81a13d9e8c5bf9470c2cbb1 Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Thu, 25 Aug 2022 14:03:27 +0200 Subject: [PATCH] Net attributes getters changes: test fixes --- .../apachecamel/RestCamelTest.groovy | 8 +- ...woServicesWithDirectClientCamelTest.groovy | 8 +- .../test/groovy/CassandraClientTest.groovy | 4 +- .../test/groovy/CassandraClientTest.groovy | 4 +- .../src/test/groovy/CouchbaseSpanUtil.groovy | 5 +- .../Elasticsearch5TransportClientTest.groovy | 30 ++-- .../Elasticsearch53TransportClientTest.groovy | 30 ++-- .../Elasticsearch6TransportClientTest.groovy | 30 ++-- .../grpc/v1_6/AbstractGrpcStreamingTest.java | 18 +- .../grpc/v1_6/AbstractGrpcTest.java | 154 +++++++++++------- .../groovy/AbstractJaxRsHttpServerTest.groovy | 4 + .../src/test/groovy/Jedis40ClientTest.groovy | 27 +-- .../src/main/groovy/BaseJsfTest.groovy | 4 + .../JspInstrumentationBasicTests.groovy | 73 ++++++--- .../JspInstrumentationForwardTests.groovy | 54 ++++-- .../v5_1/LettuceReactiveClientTest.groovy | 8 +- .../AbstractLettuceAsyncClientTest.groovy | 24 +-- .../AbstractLettuceReactiveClientTest.groovy | 36 ++-- .../AbstractLettuceSyncClientAuthTest.groovy | 4 +- .../v5_1/AbstractLettuceSyncClientTest.groovy | 48 +++--- .../testing/AbstractMongoClientTest.groovy | 1 - .../src/test/groovy/Netty38ClientTest.groovy | 6 +- .../test/groovy/Netty40ClientSslTest.groovy | 8 +- .../src/test/groovy/Netty40ClientTest.groovy | 6 +- .../test/groovy/Netty41ClientSslTest.groovy | 8 +- .../src/test/groovy/Netty41ClientTest.groovy | 6 +- .../src/test/groovy/RabbitMqTest.groovy | 4 +- .../test/groovy/ReactorRabbitMqTest.groovy | 4 +- .../groovy/server/RatpackRoutesTest.groovy | 1 - .../ratpack/RatpackForkedHttpClientTest.java | 14 ++ .../ratpack/RatpackHttpClientTest.java | 14 ++ .../ratpack/RatpackPooledHttpClientTest.java | 14 ++ .../server/AbstractRatpackRoutesTest.groovy | 8 +- .../client/AbstractRatpackHttpClientTest.java | 23 +-- .../ratpack/server/RatpackRoutesTest.groovy | 1 - .../AbstractReactorNettyHttpClientTest.groovy | 6 +- .../AbstractReactorNettyHttpClientTest.java | 32 ++-- .../v1_0/ReactorNettyClientSslTest.java | 17 +- .../v1_0/ReactorNettyConnectionSpanTest.java | 8 +- .../v1_0/ReactorNettyHttpClientTest.java | 19 +++ .../AbstractRedissonAsyncClientTest.groovy | 12 +- .../groovy/AbstractRedissonClientTest.groovy | 66 ++++---- .../src/test/groovy/SparkJavaBasedTest.groovy | 10 +- .../SpringIntegrationAndRabbitTest.groovy | 12 +- .../test/groovy/ContextPropagationTest.groovy | 8 +- .../src/test/groovy/SpringWebfluxTest.groovy | 27 +++ .../src/test/groovy/UndertowServerTest.groovy | 16 +- .../VertxReactivePropagationTest.groovy | 6 + .../VertxReactivePropagationTest.groovy | 6 + .../test/base/HttpServerTest.groovy | 3 + .../junit/http/AbstractHttpClientTest.java | 39 +++-- .../junit/http/AbstractHttpServerTest.java | 16 +- 52 files changed, 627 insertions(+), 367 deletions(-) diff --git a/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/apachecamel/RestCamelTest.groovy b/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/apachecamel/RestCamelTest.groovy index 43b04b606088..46153629f145 100644 --- a/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/apachecamel/RestCamelTest.groovy +++ b/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/apachecamel/RestCamelTest.groovy @@ -95,10 +95,14 @@ class RestCamelTest extends AgentInstrumentationSpecification implements RetryOn "$SemanticAttributes.HTTP_USER_AGENT" String "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_METHOD" "GET" + "$SemanticAttributes.HTTP_ROUTE" "/api/{module}/unit/{unitId}" + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "net.host.name" "localhost" + "net.host.port" port "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long - "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.HTTP_ROUTE" "/api/{module}/unit/{unitId}" + "net.sock.host.name" String + "net.sock.host.addr" "127.0.0.1" } } it.span(3) { diff --git a/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/apachecamel/TwoServicesWithDirectClientCamelTest.groovy b/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/apachecamel/TwoServicesWithDirectClientCamelTest.groovy index 3b4605337756..1e465b758b1c 100644 --- a/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/apachecamel/TwoServicesWithDirectClientCamelTest.groovy +++ b/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/apachecamel/TwoServicesWithDirectClientCamelTest.groovy @@ -128,13 +128,15 @@ class TwoServicesWithDirectClientCamelTest extends AgentInstrumentationSpecifica "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "127.0.0.1:$portTwo" "$SemanticAttributes.HTTP_TARGET" "/serviceTwo" - "net.sock.peer.port" Number - "net.sock.peer.addr" "127.0.0.1" "$SemanticAttributes.HTTP_USER_AGENT" "Jakarta Commons-HttpClient/3.1" "$SemanticAttributes.HTTP_FLAVOR" "1.1" - "$SemanticAttributes.NET_TRANSPORT" IP_TCP "$SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH" Long "$SemanticAttributes.HTTP_ROUTE" "/serviceTwo" + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "net.host.name" "127.0.0.1" + "net.host.port" portTwo + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long } } it.span(5) { diff --git a/instrumentation/cassandra/cassandra-3.0/javaagent/src/test/groovy/CassandraClientTest.groovy b/instrumentation/cassandra/cassandra-3.0/javaagent/src/test/groovy/CassandraClientTest.groovy index 6a94fa8b3de2..858d7c9c79be 100644 --- a/instrumentation/cassandra/cassandra-3.0/javaagent/src/test/groovy/CassandraClientTest.groovy +++ b/instrumentation/cassandra/cassandra-3.0/javaagent/src/test/groovy/CassandraClientTest.groovy @@ -147,9 +147,9 @@ class CassandraClientTest extends AgentInstrumentationSpecification { childOf((SpanData) parentSpan) } attributes { - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" cassandraPort "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" cassandraPort "$SemanticAttributes.DB_SYSTEM" "cassandra" "$SemanticAttributes.DB_NAME" keyspace "$SemanticAttributes.DB_STATEMENT" statement diff --git a/instrumentation/cassandra/cassandra-4.0/javaagent/src/test/groovy/CassandraClientTest.groovy b/instrumentation/cassandra/cassandra-4.0/javaagent/src/test/groovy/CassandraClientTest.groovy index 0d5f345082a8..9f615175515d 100644 --- a/instrumentation/cassandra/cassandra-4.0/javaagent/src/test/groovy/CassandraClientTest.groovy +++ b/instrumentation/cassandra/cassandra-4.0/javaagent/src/test/groovy/CassandraClientTest.groovy @@ -120,9 +120,9 @@ class CassandraClientTest extends AgentInstrumentationSpecification { childOf((SpanData) parentSpan) } attributes { - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" cassandraPort "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" cassandraPort "$SemanticAttributes.DB_SYSTEM" "cassandra" "$SemanticAttributes.DB_NAME" keyspace "$SemanticAttributes.DB_STATEMENT" statement diff --git a/instrumentation/couchbase/couchbase-2.6/javaagent/src/test/groovy/CouchbaseSpanUtil.groovy b/instrumentation/couchbase/couchbase-2.6/javaagent/src/test/groovy/CouchbaseSpanUtil.groovy index 6cc47e47bc76..7ffd00ca489a 100644 --- a/instrumentation/couchbase/couchbase-2.6/javaagent/src/test/groovy/CouchbaseSpanUtil.groovy +++ b/instrumentation/couchbase/couchbase-2.6/javaagent/src/test/groovy/CouchbaseSpanUtil.groovy @@ -36,8 +36,9 @@ class CouchbaseSpanUtil { "$SemanticAttributes.NET_TRANSPORT" { it == null || it == IP_TCP } // Because of caching, not all requests hit the server so these attributes may be absent - "$SemanticAttributes.NET_PEER_NAME" { it == "localhost" || it == "127.0.0.1" || it == null } - "$SemanticAttributes.NET_PEER_PORT" { it == null || Number } + "net.sock.peer.addr" { it == "127.0.0.1" || it == null } + "net.sock.peer.name" { it == "localhost" || it == null } + "net.sock.peer.port" { it == null || Number } // Because of caching, not all requests hit the server so this tag may be absent "couchbase.local.address" { it == null || String } diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5TransportClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5TransportClientTest.groovy index 90f1a1dec413..3c8379d6c80e 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5TransportClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5TransportClientTest.groovy @@ -125,10 +125,10 @@ class Elasticsearch5TransportClientTest extends AbstractElasticsearchTransportCl name "ClusterHealthAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port - "net.sock.peer.addr" tcpPublishAddress.host != tcpPublishAddress.address ? tcpPublishAddress.host : null "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.host + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "ClusterHealthAction" "elasticsearch.action" "ClusterHealthAction" @@ -243,10 +243,10 @@ class Elasticsearch5TransportClientTest extends AbstractElasticsearchTransportCl name "CreateIndexAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port - "net.sock.peer.addr" tcpPublishAddress.host != tcpPublishAddress.address ? tcpPublishAddress.host : null "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.host + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "CreateIndexAction" "elasticsearch.action" "CreateIndexAction" @@ -260,10 +260,10 @@ class Elasticsearch5TransportClientTest extends AbstractElasticsearchTransportCl name "GetAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port - "net.sock.peer.addr" tcpPublishAddress.host != tcpPublishAddress.address ? tcpPublishAddress.host : null "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.host + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "GetAction" "elasticsearch.action" "GetAction" @@ -292,10 +292,10 @@ class Elasticsearch5TransportClientTest extends AbstractElasticsearchTransportCl name "IndexAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port - "net.sock.peer.addr" tcpPublishAddress.host != tcpPublishAddress.address ? tcpPublishAddress.host : null "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.host + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "IndexAction" "elasticsearch.action" "IndexAction" @@ -314,10 +314,10 @@ class Elasticsearch5TransportClientTest extends AbstractElasticsearchTransportCl name "GetAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port - "net.sock.peer.addr" tcpPublishAddress.host != tcpPublishAddress.address ? tcpPublishAddress.address : null "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.host + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "GetAction" "elasticsearch.action" "GetAction" diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53TransportClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53TransportClientTest.groovy index 6f065708bf77..01ee7567e798 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53TransportClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53TransportClientTest.groovy @@ -131,10 +131,10 @@ class Elasticsearch53TransportClientTest extends AbstractElasticsearchTransportC kind CLIENT childOf(span(0)) attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port - "net.sock.peer.addr" tcpPublishAddress.host != tcpPublishAddress.address ? tcpPublishAddress.address : null "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.host + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "ClusterHealthAction" "elasticsearch.action" "ClusterHealthAction" @@ -248,10 +248,10 @@ class Elasticsearch53TransportClientTest extends AbstractElasticsearchTransportC name "CreateIndexAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port - "net.sock.peer.addr" tcpPublishAddress.host != tcpPublishAddress.address ? tcpPublishAddress.address : null "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.host + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "CreateIndexAction" "elasticsearch.action" "CreateIndexAction" @@ -265,10 +265,10 @@ class Elasticsearch53TransportClientTest extends AbstractElasticsearchTransportC name "GetAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port - "net.sock.peer.addr" tcpPublishAddress.host != tcpPublishAddress.address ? tcpPublishAddress.address : null "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.host + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "GetAction" "elasticsearch.action" "GetAction" @@ -297,10 +297,10 @@ class Elasticsearch53TransportClientTest extends AbstractElasticsearchTransportC name "IndexAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port - "net.sock.peer.addr" tcpPublishAddress.host != tcpPublishAddress.address ? tcpPublishAddress.address : null "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.host + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "IndexAction" "elasticsearch.action" "IndexAction" @@ -320,10 +320,10 @@ class Elasticsearch53TransportClientTest extends AbstractElasticsearchTransportC name "GetAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port - "net.sock.peer.addr" tcpPublishAddress.host != tcpPublishAddress.address ? tcpPublishAddress.address : null "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.host + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "GetAction" "elasticsearch.action" "GetAction" 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 9065777ad651..32c24833e8ce 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,8 +105,10 @@ class Elasticsearch6TransportClientTest extends AbstractElasticsearchTransportCl kind CLIENT childOf(span(0)) attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port + "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.address().hostString + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "ClusterHealthAction" "elasticsearch.action" "ClusterHealthAction" @@ -223,8 +225,10 @@ class Elasticsearch6TransportClientTest extends AbstractElasticsearchTransportCl name "CreateIndexAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port + "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.address().hostString + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "CreateIndexAction" "elasticsearch.action" "CreateIndexAction" @@ -238,8 +242,10 @@ class Elasticsearch6TransportClientTest extends AbstractElasticsearchTransportCl name "GetAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port + "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.address().hostString + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "GetAction" "elasticsearch.action" "GetAction" @@ -268,8 +274,10 @@ class Elasticsearch6TransportClientTest extends AbstractElasticsearchTransportCl name "IndexAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port + "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.address().hostString + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "IndexAction" "elasticsearch.action" "IndexAction" @@ -289,8 +297,10 @@ class Elasticsearch6TransportClientTest extends AbstractElasticsearchTransportCl name "GetAction" kind CLIENT attributes { - "$SemanticAttributes.NET_PEER_NAME" tcpPublishAddress.address - "$SemanticAttributes.NET_PEER_PORT" tcpPublishAddress.port + "net.sock.family" { it == "inet6" || it == null } + "net.sock.peer.addr" tcpPublishAddress.address + "net.sock.peer.name" tcpPublishAddress.address().hostString + "net.sock.peer.port" tcpPublishAddress.port "$SemanticAttributes.DB_SYSTEM" "elasticsearch" "$SemanticAttributes.DB_OPERATION" "GetAction" "elasticsearch.action" "GetAction" diff --git a/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcStreamingTest.java b/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcStreamingTest.java index f63f6dc27c9f..8c1a1f81040b 100644 --- a/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcStreamingTest.java +++ b/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcStreamingTest.java @@ -196,16 +196,18 @@ public void onCompleted() { equalTo(SemanticAttributes.RPC_SYSTEM, "grpc"), equalTo(SemanticAttributes.RPC_SERVICE, "example.Greeter"), equalTo(SemanticAttributes.RPC_METHOD, "Conversation"), - equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), - satisfies( - AttributeKey.longKey("net.sock.peer.port"), - val -> assertThat(val).isNotNull()), + equalTo( + SemanticAttributes.RPC_GRPC_STATUS_CODE, + (long) Status.Code.OK.value()), equalTo( SemanticAttributes.NET_TRANSPORT, SemanticAttributes.NetTransportValues.IP_TCP), - equalTo( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value())) + equalTo(SemanticAttributes.NET_HOST_NAME, "localhost"), + equalTo(SemanticAttributes.NET_HOST_PORT, server.getPort()), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + satisfies( + AttributeKey.longKey("net.sock.peer.port"), + val -> assertThat(val).isNotNull())) .hasEventsSatisfyingExactly(events.toArray(new Consumer[0])))); testing() .waitAndAssertMetrics( @@ -222,6 +224,8 @@ public void onCompleted() { point -> point.hasAttributesSatisfying( equalTo(SemanticAttributes.NET_TRANSPORT, "ip_tcp"), + equalTo( + SemanticAttributes.NET_HOST_NAME, "localhost"), equalTo( SemanticAttributes.RPC_METHOD, "Conversation"), equalTo( diff --git a/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcTest.java b/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcTest.java index e37514c98f08..94c5aebab3df 100644 --- a/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcTest.java +++ b/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcTest.java @@ -164,16 +164,18 @@ public void sayHello( equalTo(SemanticAttributes.RPC_SYSTEM, "grpc"), equalTo(SemanticAttributes.RPC_SERVICE, "example.Greeter"), equalTo(SemanticAttributes.RPC_METHOD, "SayHello"), - equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), - satisfies( - AttributeKey.longKey("net.sock.peer.port"), - val -> assertThat(val).isNotNull()), + equalTo( + SemanticAttributes.RPC_GRPC_STATUS_CODE, + (long) Status.Code.OK.value()), equalTo( SemanticAttributes.NET_TRANSPORT, SemanticAttributes.NetTransportValues.IP_TCP), - equalTo( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value())) + equalTo(SemanticAttributes.NET_HOST_NAME, "localhost"), + equalTo(SemanticAttributes.NET_HOST_PORT, server.getPort()), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + satisfies( + AttributeKey.longKey("net.sock.peer.port"), + val -> assertThat(val).isNotNull())) .hasEventsSatisfyingExactly( event -> event @@ -213,6 +215,8 @@ public void sayHello( point -> point.hasAttributesSatisfying( equalTo(SemanticAttributes.NET_TRANSPORT, "ip_tcp"), + equalTo( + SemanticAttributes.NET_HOST_NAME, "localhost"), equalTo(SemanticAttributes.RPC_METHOD, "SayHello"), equalTo( SemanticAttributes.RPC_SERVICE, @@ -342,16 +346,18 @@ public void sayHello( equalTo(SemanticAttributes.RPC_SYSTEM, "grpc"), equalTo(SemanticAttributes.RPC_SERVICE, "example.Greeter"), equalTo(SemanticAttributes.RPC_METHOD, "SayHello"), - equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), - satisfies( - AttributeKey.longKey("net.sock.peer.port"), - val -> assertThat(val).isNotNull()), + equalTo( + SemanticAttributes.RPC_GRPC_STATUS_CODE, + (long) Status.Code.OK.value()), equalTo( SemanticAttributes.NET_TRANSPORT, SemanticAttributes.NetTransportValues.IP_TCP), - equalTo( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value())) + equalTo(SemanticAttributes.NET_HOST_NAME, "localhost"), + equalTo(SemanticAttributes.NET_HOST_PORT, server.getPort()), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + satisfies( + AttributeKey.longKey("net.sock.peer.port"), + val -> assertThat(val).isNotNull())) .hasEventsSatisfyingExactly( event -> event @@ -394,6 +400,8 @@ public void sayHello( point -> point.hasAttributesSatisfying( equalTo(SemanticAttributes.NET_TRANSPORT, "ip_tcp"), + equalTo( + SemanticAttributes.NET_HOST_NAME, "localhost"), equalTo(SemanticAttributes.RPC_METHOD, "SayHello"), equalTo( SemanticAttributes.RPC_SERVICE, @@ -531,16 +539,18 @@ public void onCompleted() { equalTo(SemanticAttributes.RPC_SYSTEM, "grpc"), equalTo(SemanticAttributes.RPC_SERVICE, "example.Greeter"), equalTo(SemanticAttributes.RPC_METHOD, "SayHello"), - equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), - satisfies( - AttributeKey.longKey("net.sock.peer.port"), - val -> assertThat(val).isNotNull()), + equalTo( + SemanticAttributes.RPC_GRPC_STATUS_CODE, + (long) Status.Code.OK.value()), equalTo( SemanticAttributes.NET_TRANSPORT, SemanticAttributes.NetTransportValues.IP_TCP), - equalTo( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value())) + equalTo(SemanticAttributes.NET_HOST_NAME, "localhost"), + equalTo(SemanticAttributes.NET_HOST_PORT, server.getPort()), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + satisfies( + AttributeKey.longKey("net.sock.peer.port"), + val -> assertThat(val).isNotNull())) .hasEventsSatisfyingExactly( event -> event @@ -583,6 +593,8 @@ public void onCompleted() { point -> point.hasAttributesSatisfying( equalTo(SemanticAttributes.NET_TRANSPORT, "ip_tcp"), + equalTo( + SemanticAttributes.NET_HOST_NAME, "localhost"), equalTo(SemanticAttributes.RPC_METHOD, "SayHello"), equalTo( SemanticAttributes.RPC_SERVICE, @@ -684,16 +696,18 @@ public void sayHello( equalTo(SemanticAttributes.RPC_SYSTEM, "grpc"), equalTo(SemanticAttributes.RPC_SERVICE, "example.Greeter"), equalTo(SemanticAttributes.RPC_METHOD, "SayHello"), - equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), - satisfies( - AttributeKey.longKey("net.sock.peer.port"), - val -> assertThat(val).isNotNull()), + equalTo( + SemanticAttributes.RPC_GRPC_STATUS_CODE, + (long) status.getCode().value()), equalTo( SemanticAttributes.NET_TRANSPORT, SemanticAttributes.NetTransportValues.IP_TCP), - equalTo( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - (long) status.getCode().value())) + equalTo(SemanticAttributes.NET_HOST_NAME, "localhost"), + equalTo(SemanticAttributes.NET_HOST_PORT, server.getPort()), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + satisfies( + AttributeKey.longKey("net.sock.peer.port"), + val -> assertThat(val).isNotNull())) .hasEventsSatisfying( events -> { assertThat(events).isNotEmpty(); @@ -729,6 +743,8 @@ public void sayHello( point -> point.hasAttributesSatisfying( equalTo(SemanticAttributes.NET_TRANSPORT, "ip_tcp"), + equalTo( + SemanticAttributes.NET_HOST_NAME, "localhost"), equalTo(SemanticAttributes.RPC_METHOD, "SayHello"), equalTo( SemanticAttributes.RPC_SERVICE, @@ -836,16 +852,18 @@ public void sayHello( equalTo(SemanticAttributes.RPC_SYSTEM, "grpc"), equalTo(SemanticAttributes.RPC_SERVICE, "example.Greeter"), equalTo(SemanticAttributes.RPC_METHOD, "SayHello"), - equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), - satisfies( - AttributeKey.longKey("net.sock.peer.port"), - val -> assertThat(val).isNotNull()), + equalTo( + SemanticAttributes.RPC_GRPC_STATUS_CODE, + (long) Status.Code.UNKNOWN.value()), equalTo( SemanticAttributes.NET_TRANSPORT, SemanticAttributes.NetTransportValues.IP_TCP), - equalTo( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.UNKNOWN.value())) + equalTo(SemanticAttributes.NET_HOST_NAME, "localhost"), + equalTo(SemanticAttributes.NET_HOST_PORT, server.getPort()), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + satisfies( + AttributeKey.longKey("net.sock.peer.port"), + val -> assertThat(val).isNotNull())) .hasEventsSatisfying( events -> { assertThat(events).hasSize(2); @@ -876,6 +894,8 @@ public void sayHello( point -> point.hasAttributesSatisfying( equalTo(SemanticAttributes.NET_TRANSPORT, "ip_tcp"), + equalTo( + SemanticAttributes.NET_HOST_NAME, "localhost"), equalTo(SemanticAttributes.RPC_METHOD, "SayHello"), equalTo( SemanticAttributes.RPC_SERVICE, @@ -1089,16 +1109,18 @@ public void onCompleted() { equalTo(SemanticAttributes.RPC_SYSTEM, "grpc"), equalTo(SemanticAttributes.RPC_SERVICE, "example.Greeter"), equalTo(SemanticAttributes.RPC_METHOD, "SayHello"), - equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), - satisfies( - AttributeKey.longKey("net.sock.peer.port"), - val -> assertThat(val).isNotNull()), + equalTo( + SemanticAttributes.RPC_GRPC_STATUS_CODE, + (long) Status.Code.OK.value()), equalTo( SemanticAttributes.NET_TRANSPORT, SemanticAttributes.NetTransportValues.IP_TCP), - equalTo( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value())) + equalTo(SemanticAttributes.NET_HOST_NAME, "localhost"), + equalTo(SemanticAttributes.NET_HOST_PORT, server.getPort()), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + satisfies( + AttributeKey.longKey("net.sock.peer.port"), + val -> assertThat(val).isNotNull())) .hasEventsSatisfyingExactly( event -> event @@ -1230,16 +1252,18 @@ public void onCompleted() { equalTo(SemanticAttributes.RPC_SYSTEM, "grpc"), equalTo(SemanticAttributes.RPC_SERVICE, "example.Greeter"), equalTo(SemanticAttributes.RPC_METHOD, "SayMultipleHello"), - equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), - satisfies( - AttributeKey.longKey("net.sock.peer.port"), - val -> assertThat(val).isNotNull()), + equalTo( + SemanticAttributes.RPC_GRPC_STATUS_CODE, + (long) Status.Code.CANCELLED.value()), equalTo( SemanticAttributes.NET_TRANSPORT, SemanticAttributes.NetTransportValues.IP_TCP), - equalTo( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.CANCELLED.value())) + equalTo(SemanticAttributes.NET_HOST_NAME, "localhost"), + equalTo(SemanticAttributes.NET_HOST_PORT, server.getPort()), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + satisfies( + AttributeKey.longKey("net.sock.peer.port"), + val -> assertThat(val).isNotNull())) .hasEventsSatisfyingExactly( event -> event @@ -1371,16 +1395,18 @@ public void onCompleted() { SemanticAttributes.RPC_SERVICE, "grpc.reflection.v1alpha.ServerReflection"), equalTo(SemanticAttributes.RPC_METHOD, "ServerReflectionInfo"), - equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), - satisfies( - AttributeKey.longKey("net.sock.peer.port"), - val -> assertThat(val).isNotNull()), + equalTo( + SemanticAttributes.RPC_GRPC_STATUS_CODE, + (long) Status.Code.OK.value()), equalTo( SemanticAttributes.NET_TRANSPORT, SemanticAttributes.NetTransportValues.IP_TCP), - equalTo( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value())) + equalTo(SemanticAttributes.NET_HOST_NAME, "localhost"), + equalTo(SemanticAttributes.NET_HOST_PORT, server.getPort()), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + satisfies( + AttributeKey.longKey("net.sock.peer.port"), + val -> assertThat(val).isNotNull())) .hasEventsSatisfyingExactly( event -> event @@ -1495,16 +1521,18 @@ public void sayHello( equalTo(SemanticAttributes.RPC_SYSTEM, "grpc"), equalTo(SemanticAttributes.RPC_SERVICE, "example.Greeter"), equalTo(SemanticAttributes.RPC_METHOD, "SayHello"), - equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), - satisfies( - AttributeKey.longKey("net.sock.peer.port"), - val -> assertThat(val).isNotNull()), + equalTo( + SemanticAttributes.RPC_GRPC_STATUS_CODE, + (long) Status.Code.OK.value()), equalTo( SemanticAttributes.NET_TRANSPORT, SemanticAttributes.NetTransportValues.IP_TCP), - equalTo( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value())) + equalTo(SemanticAttributes.NET_HOST_NAME, "localhost"), + equalTo(SemanticAttributes.NET_HOST_PORT, server.getPort()), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + satisfies( + AttributeKey.longKey("net.sock.peer.port"), + val -> assertThat(val).isNotNull())) .hasEventsSatisfyingExactly( event -> event diff --git a/instrumentation/jaxrs/jaxrs-common/testing/src/main/groovy/AbstractJaxRsHttpServerTest.groovy b/instrumentation/jaxrs/jaxrs-common/testing/src/main/groovy/AbstractJaxRsHttpServerTest.groovy index 91acbad24ab9..d5768f605846 100644 --- a/instrumentation/jaxrs/jaxrs-common/testing/src/main/groovy/AbstractJaxRsHttpServerTest.groovy +++ b/instrumentation/jaxrs/jaxrs-common/testing/src/main/groovy/AbstractJaxRsHttpServerTest.groovy @@ -268,8 +268,12 @@ abstract class AbstractJaxRsHttpServerTest extends HttpServerTest implemen hasNoParent() } attributes { + "net.host.name" fullUrl.host + "net.host.port" fullUrl.port "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" { it == "127.0.0.1" || it == "localhost" || it == null } "$SemanticAttributes.HTTP_SCHEME" fullUrl.getScheme() "$SemanticAttributes.HTTP_HOST" fullUrl.getHost() + ":" + fullUrl.getPort() "$SemanticAttributes.HTTP_TARGET" fullUrl.getPath() + (fullUrl.getQuery() != null ? "?" + fullUrl.getQuery() : "") 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 94ea0be4cfff..28fed6057bcd 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("127.0.0.1", port) + jedis = new Jedis("localhost", port) } def cleanupSpec() { @@ -51,9 +51,10 @@ class Jedis40ClientTest extends AgentInstrumentationSpecification { "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET foo ?" "$SemanticAttributes.DB_OPERATION" "SET" - "$SemanticAttributes.NET_PEER_NAME" "127.0.0.1" - "$SemanticAttributes.NET_PEER_PORT" port "$SemanticAttributes.NET_TRANSPORT" SemanticAttributes.NetTransportValues.IP_TCP + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port } } } @@ -77,9 +78,10 @@ class Jedis40ClientTest extends AgentInstrumentationSpecification { "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET foo ?" "$SemanticAttributes.DB_OPERATION" "SET" - "$SemanticAttributes.NET_PEER_NAME" "127.0.0.1" - "$SemanticAttributes.NET_PEER_PORT" port "$SemanticAttributes.NET_TRANSPORT" SemanticAttributes.NetTransportValues.IP_TCP + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port } } } @@ -91,9 +93,10 @@ class Jedis40ClientTest extends AgentInstrumentationSpecification { "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "GET foo" "$SemanticAttributes.DB_OPERATION" "GET" - "$SemanticAttributes.NET_PEER_NAME" "127.0.0.1" - "$SemanticAttributes.NET_PEER_PORT" port "$SemanticAttributes.NET_TRANSPORT" SemanticAttributes.NetTransportValues.IP_TCP + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port } } } @@ -117,9 +120,10 @@ class Jedis40ClientTest extends AgentInstrumentationSpecification { "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET foo ?" "$SemanticAttributes.DB_OPERATION" "SET" - "$SemanticAttributes.NET_PEER_NAME" "127.0.0.1" - "$SemanticAttributes.NET_PEER_PORT" port "$SemanticAttributes.NET_TRANSPORT" SemanticAttributes.NetTransportValues.IP_TCP + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port } } } @@ -131,9 +135,10 @@ class Jedis40ClientTest extends AgentInstrumentationSpecification { "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "RANDOMKEY" "$SemanticAttributes.DB_OPERATION" "RANDOMKEY" - "$SemanticAttributes.NET_PEER_NAME" "127.0.0.1" - "$SemanticAttributes.NET_PEER_PORT" port "$SemanticAttributes.NET_TRANSPORT" SemanticAttributes.NetTransportValues.IP_TCP + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port } } } diff --git a/instrumentation/jsf/jsf-common/testing/src/main/groovy/BaseJsfTest.groovy b/instrumentation/jsf/jsf-common/testing/src/main/groovy/BaseJsfTest.groovy index 6f28adecabef..683576b877fc 100644 --- a/instrumentation/jsf/jsf-common/testing/src/main/groovy/BaseJsfTest.groovy +++ b/instrumentation/jsf/jsf-common/testing/src/main/groovy/BaseJsfTest.groovy @@ -98,8 +98,12 @@ abstract class BaseJsfTest extends AgentInstrumentationSpecification implements hasNoParent() attributes { "$SemanticAttributes.NET_TRANSPORT" SemanticAttributes.NetTransportValues.IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" "127.0.0.1" "$SemanticAttributes.HTTP_METHOD" "GET" "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:$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 f292a4f1a74c..5b793aa7f0ba 100644 --- a/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationBasicTests.groovy +++ b/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationBasicTests.groovy @@ -90,8 +90,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { name route kind SERVER attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" route @@ -99,10 +97,14 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_STATUS_CODE" 200 "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String - "$SemanticAttributes.NET_TRANSPORT" IP_TCP - // Optional "$SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH" { it == null || it instanceof Long } "$SemanticAttributes.HTTP_ROUTE" route + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" } } span(1) { @@ -148,8 +150,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { name route kind SERVER attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" "$route?$queryString" @@ -157,8 +157,13 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_STATUS_CODE" 200 "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String - "$SemanticAttributes.NET_TRANSPORT" IP_TCP "$SemanticAttributes.HTTP_ROUTE" route + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" } } span(1) { @@ -200,8 +205,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { name route kind SERVER attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" route @@ -209,9 +212,14 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_STATUS_CODE" 200 "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String - "$SemanticAttributes.NET_TRANSPORT" IP_TCP "$SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH" Long "$SemanticAttributes.HTTP_ROUTE" route + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" } } span(1) { @@ -262,8 +270,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { } } attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" route @@ -271,8 +277,13 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_STATUS_CODE" 500 "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String - "$SemanticAttributes.NET_TRANSPORT" IP_TCP "$SemanticAttributes.HTTP_ROUTE" route + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" } } span(1) { @@ -328,8 +339,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { name route kind SERVER attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" route @@ -337,8 +346,13 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_STATUS_CODE" 200 "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String - "$SemanticAttributes.NET_TRANSPORT" IP_TCP "$SemanticAttributes.HTTP_ROUTE" route + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" } } span(1) { @@ -375,8 +389,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { name route kind SERVER attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" route @@ -384,8 +396,13 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_STATUS_CODE" 200 "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String - "$SemanticAttributes.NET_TRANSPORT" IP_TCP "$SemanticAttributes.HTTP_ROUTE" route + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" } } span(1) { @@ -454,8 +471,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { status ERROR errorEvent(JasperException, String) attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" route @@ -463,8 +478,13 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_STATUS_CODE" 500 "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String - "$SemanticAttributes.NET_TRANSPORT" IP_TCP "$SemanticAttributes.HTTP_ROUTE" route + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" } } span(1) { @@ -502,8 +522,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { name route kind SERVER attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" "/$jspWebappContext/$staticFile" @@ -511,8 +529,13 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_STATUS_CODE" 200 "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String - "$SemanticAttributes.NET_TRANSPORT" IP_TCP "$SemanticAttributes.HTTP_ROUTE" route + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" } } } 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 754a23ac7c23..90dce4d1ef61 100644 --- a/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationForwardTests.groovy +++ b/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationForwardTests.groovy @@ -88,8 +88,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { name route kind SERVER attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" route @@ -97,8 +95,13 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_STATUS_CODE" 200 "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String - "$SemanticAttributes.NET_TRANSPORT" IP_TCP "$SemanticAttributes.HTTP_ROUTE" route + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" } } span(1) { @@ -156,8 +159,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { name route kind SERVER attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" route @@ -165,8 +166,13 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_STATUS_CODE" 200 "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String - "$SemanticAttributes.NET_TRANSPORT" IP_TCP "$SemanticAttributes.HTTP_ROUTE" route + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" } } span(1) { @@ -203,8 +209,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { name route kind SERVER attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" route @@ -212,8 +216,13 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_STATUS_CODE" 200 "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String - "$SemanticAttributes.NET_TRANSPORT" IP_TCP "$SemanticAttributes.HTTP_ROUTE" route + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" } } span(1) { @@ -298,8 +307,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { name route kind SERVER attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" route @@ -307,8 +314,13 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_STATUS_CODE" 200 "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String - "$SemanticAttributes.NET_TRANSPORT" IP_TCP "$SemanticAttributes.HTTP_ROUTE" route + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" } } span(1) { @@ -379,8 +391,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { status ERROR errorEvent(JasperException, String) attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" route @@ -388,8 +398,13 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_STATUS_CODE" 500 "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String - "$SemanticAttributes.NET_TRANSPORT" IP_TCP "$SemanticAttributes.HTTP_ROUTE" route + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" } } span(1) { @@ -439,8 +454,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { kind SERVER status UNSET attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" route @@ -448,8 +461,13 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_STATUS_CODE" 404 "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String - "$SemanticAttributes.NET_TRANSPORT" IP_TCP "$SemanticAttributes.HTTP_ROUTE" route + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" } } span(1) { diff --git a/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceReactiveClientTest.groovy b/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceReactiveClientTest.groovy index cb54f0c8722f..f50501dc363e 100644 --- a/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceReactiveClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceReactiveClientTest.groovy @@ -45,9 +45,9 @@ class LettuceReactiveClientTest extends AbstractLettuceReactiveClientTest implem childOf span(0) attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET a ?" } @@ -64,9 +64,9 @@ class LettuceReactiveClientTest extends AbstractLettuceReactiveClientTest implem childOf span(0) attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "GET a" } diff --git a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceAsyncClientTest.groovy b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceAsyncClientTest.groovy index c956b0c8ff9f..5dbbdbe975a9 100644 --- a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceAsyncClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceAsyncClientTest.groovy @@ -160,9 +160,9 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET TESTSETKEY ?" } @@ -211,9 +211,9 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "GET TESTKEY" } @@ -286,9 +286,9 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati childOf(span(0)) attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "GET NON_EXISTENT_KEY" } @@ -350,9 +350,9 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati childOf(span(0)) attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_STATEMENT" "RANDOMKEY" "$SemanticAttributes.DB_SYSTEM" "redis" } @@ -417,9 +417,9 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "HMSET TESTHM firstname ? lastname ? age ?" } @@ -437,9 +437,9 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "HGETALL TESTHM" } diff --git a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceReactiveClientTest.groovy b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceReactiveClientTest.groovy index 53de14bf9a09..6227da87cd04 100644 --- a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceReactiveClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceReactiveClientTest.groovy @@ -102,9 +102,9 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific childOf(span(0)) attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET TESTSETKEY ?" } @@ -140,9 +140,9 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "GET TESTKEY" } @@ -191,9 +191,9 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific childOf(span(0)) attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "GET NON_EXISTENT_KEY" } @@ -235,9 +235,9 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_STATEMENT" "RANDOMKEY" "$SemanticAttributes.DB_SYSTEM" "redis" } @@ -264,9 +264,9 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_STATEMENT" "COMMAND" "$SemanticAttributes.DB_SYSTEM" "redis" } @@ -312,9 +312,9 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific childOf span(0) attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET a ?" } @@ -331,9 +331,9 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific childOf span(0) attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "GET a" } @@ -370,9 +370,9 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific childOf span(0) attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET a ?" } @@ -389,9 +389,9 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific childOf span(0) attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "GET a" } diff --git a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientAuthTest.groovy b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientAuthTest.groovy index db9d2b39af72..7438c9f8f9fc 100644 --- a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientAuthTest.groovy +++ b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientAuthTest.groovy @@ -68,9 +68,9 @@ abstract class AbstractLettuceSyncClientAuthTest extends InstrumentationSpecific kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "AUTH ?" } diff --git a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientTest.groovy b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientTest.groovy index fe87c5d80a32..18f4099324ca 100644 --- a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientTest.groovy @@ -124,9 +124,9 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET TESTSETKEY ?" } @@ -157,9 +157,9 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" "localhost" "net.sock.peer.addr" "127.0.0.1" - "$SemanticAttributes.NET_PEER_PORT" port + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET TESTSETKEY ?" } @@ -191,9 +191,9 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "GET TESTKEY" } @@ -221,9 +221,9 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "GET NON_EXISTENT_KEY" } @@ -251,9 +251,9 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_STATEMENT" "RANDOMKEY" "$SemanticAttributes.DB_SYSTEM" "redis" } @@ -281,9 +281,9 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "LPUSH TESTLIST ?" } @@ -311,9 +311,9 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "HMSET user firstname ? lastname ? age ?" } @@ -341,9 +341,9 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "HGETALL TESTHM" } @@ -376,9 +376,9 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "EVAL $b64Script 1 TESTLIST ? ?" } @@ -410,9 +410,9 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio kind CLIENT attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "MSET key1 ? key2 ?" } @@ -440,9 +440,9 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio // Disconnect not an actual error even though an exception is recorded. attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "DEBUG SEGFAULT" } @@ -476,9 +476,9 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio } attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" expectedHostAttributeValue - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" expectedHostAttributeValue + "net.sock.peer.port" port "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SHUTDOWN NOSAVE" if (!Boolean.getBoolean("testLatestDeps")) { diff --git a/instrumentation/mongo/mongo-common/testing/src/main/groovy/io/opentelemetry/instrumentation/mongo/testing/AbstractMongoClientTest.groovy b/instrumentation/mongo/mongo-common/testing/src/main/groovy/io/opentelemetry/instrumentation/mongo/testing/AbstractMongoClientTest.groovy index 2166382aa421..4d12f5aad546 100644 --- a/instrumentation/mongo/mongo-common/testing/src/main/groovy/io/opentelemetry/instrumentation/mongo/testing/AbstractMongoClientTest.groovy +++ b/instrumentation/mongo/mongo-common/testing/src/main/groovy/io/opentelemetry/instrumentation/mongo/testing/AbstractMongoClientTest.groovy @@ -389,7 +389,6 @@ abstract class AbstractMongoClientTest extends InstrumentationSpecification { attributes { "$SemanticAttributes.NET_PEER_NAME" "localhost" "$SemanticAttributes.NET_PEER_PORT" port - "net.sock.peer.addr" "127.0.0.1" "$SemanticAttributes.DB_STATEMENT" { statementEval.call(it.replaceAll(" ", "")) } diff --git a/instrumentation/netty/netty-3.8/javaagent/src/test/groovy/Netty38ClientTest.groovy b/instrumentation/netty/netty-3.8/javaagent/src/test/groovy/Netty38ClientTest.groovy index a199eb4d7852..71991eb3ce81 100644 --- a/instrumentation/netty/netty-3.8/javaagent/src/test/groovy/Netty38ClientTest.groovy +++ b/instrumentation/netty/netty-3.8/javaagent/src/test/groovy/Netty38ClientTest.groovy @@ -15,6 +15,7 @@ import io.opentelemetry.context.Scope import io.opentelemetry.instrumentation.test.AgentTestTrait import io.opentelemetry.instrumentation.test.base.HttpClientTest import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpClientTest +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import spock.lang.AutoCleanup import spock.lang.Shared @@ -128,7 +129,10 @@ class Netty38ClientTest extends HttpClientTest implements AgentTestTrai case "http://192.0.2.1/": // non routable address return [] } - return super.httpAttributes(uri) + def attributes = super.httpAttributes(uri) + attributes.remove(SemanticAttributes.NET_PEER_NAME) + attributes.remove(SemanticAttributes.NET_PEER_PORT) + return attributes } @Override diff --git a/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientSslTest.groovy b/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientSslTest.groovy index eab3a9f3d217..58a6f8ad3bde 100644 --- a/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientSslTest.groovy +++ b/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientSslTest.groovy @@ -104,9 +104,9 @@ class Netty40ClientSslTest extends AgentInstrumentationSpecification { errorEventWithAnyMessage(SSLHandshakeException) attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" uri.host - "$SemanticAttributes.NET_PEER_PORT" uri.port "net.sock.peer.addr" { it == "127.0.0.1" || it == null } + "net.sock.peer.name" uri.host + "net.sock.peer.port" uri.port } } } @@ -157,9 +157,9 @@ class Netty40ClientSslTest extends AgentInstrumentationSpecification { childOf span(0) attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" uri.host - "$SemanticAttributes.NET_PEER_PORT" uri.port "net.sock.peer.addr" { it == "127.0.0.1" || it == null } + "net.sock.peer.name" uri.host + "net.sock.peer.port" uri.port } } span(3) { diff --git a/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientTest.groovy b/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientTest.groovy index 37b5707c2ea3..1fe13741b222 100644 --- a/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientTest.groovy +++ b/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientTest.groovy @@ -23,6 +23,7 @@ import io.opentelemetry.api.common.AttributeKey import io.opentelemetry.instrumentation.test.AgentTestTrait import io.opentelemetry.instrumentation.test.base.HttpClientTest import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpClientTest +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import spock.lang.Shared import java.util.concurrent.CompletableFuture @@ -126,7 +127,10 @@ class Netty40ClientTest extends HttpClientTest implement case "http://192.0.2.1/": // non routable address return [] } - return super.httpAttributes(uri) + def attributes = super.httpAttributes(uri) + attributes.remove(SemanticAttributes.NET_PEER_NAME) + attributes.remove(SemanticAttributes.NET_PEER_PORT) + return attributes } @Override diff --git a/instrumentation/netty/netty-4.1/javaagent/src/test/groovy/Netty41ClientSslTest.groovy b/instrumentation/netty/netty-4.1/javaagent/src/test/groovy/Netty41ClientSslTest.groovy index 3f760bac6f3d..40de84ee8bf3 100644 --- a/instrumentation/netty/netty-4.1/javaagent/src/test/groovy/Netty41ClientSslTest.groovy +++ b/instrumentation/netty/netty-4.1/javaagent/src/test/groovy/Netty41ClientSslTest.groovy @@ -118,9 +118,9 @@ class Netty41ClientSslTest extends AgentInstrumentationSpecification { errorEventWithAnyMessage(SSLHandshakeException) attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" uri.host - "$SemanticAttributes.NET_PEER_PORT" uri.port "net.sock.peer.addr" { it == "127.0.0.1" || it == null } + "net.sock.peer.name" uri.host + "net.sock.peer.port" uri.port } } } @@ -183,9 +183,9 @@ class Netty41ClientSslTest extends AgentInstrumentationSpecification { childOf span(0) attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "$SemanticAttributes.NET_PEER_NAME" uri.host - "$SemanticAttributes.NET_PEER_PORT" uri.port "net.sock.peer.addr" { it == "127.0.0.1" || it == null } + "net.sock.peer.name" uri.host + "net.sock.peer.port" uri.port } } span(4) { diff --git a/instrumentation/netty/netty-4.1/javaagent/src/test/groovy/Netty41ClientTest.groovy b/instrumentation/netty/netty-4.1/javaagent/src/test/groovy/Netty41ClientTest.groovy index 99268b5c84ba..f4a822216d0a 100644 --- a/instrumentation/netty/netty-4.1/javaagent/src/test/groovy/Netty41ClientTest.groovy +++ b/instrumentation/netty/netty-4.1/javaagent/src/test/groovy/Netty41ClientTest.groovy @@ -31,6 +31,7 @@ import io.opentelemetry.instrumentation.test.base.HttpClientTest import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpClientTest import io.opentelemetry.instrumentation.testing.junit.http.SingleConnection import io.opentelemetry.javaagent.instrumentation.netty.v4_1.client.HttpClientTracingHandler +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import spock.lang.Shared import spock.lang.Unroll @@ -154,7 +155,10 @@ class Netty41ClientTest extends HttpClientTest implement case "https://192.0.2.1/": // non routable address return [] } - return super.httpAttributes(uri) + def attributes = super.httpAttributes(uri) + attributes.remove(SemanticAttributes.NET_PEER_NAME) + attributes.remove(SemanticAttributes.NET_PEER_PORT) + return attributes } @Override diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMqTest.groovy b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMqTest.groovy index dd951341523c..6a4ea6d5a6d6 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMqTest.groovy +++ b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMqTest.groovy @@ -394,11 +394,9 @@ class RabbitMqTest extends AgentInstrumentationSpecification implements WithRabb } attributes { - // "localhost" on linux, "127.0.0.1" on windows if (spanKind != CONSUMER) { - "$SemanticAttributes.NET_PEER_NAME" { it == "localhost" || it == "127.0.0.1" || it == "0:0:0:0:0:0:0:1" } - "$SemanticAttributes.NET_PEER_PORT" Long "net.sock.peer.addr" { it == "127.0.0.1" || it == "0:0:0:0:0:0:0:1" || it == null } + "net.sock.peer.port" Long "net.sock.family" { it == null || it == "inet6" } } diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/ReactorRabbitMqTest.groovy b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/ReactorRabbitMqTest.groovy index d56fbcee72b8..e9e8012c3d0e 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/ReactorRabbitMqTest.groovy +++ b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/ReactorRabbitMqTest.groovy @@ -37,10 +37,8 @@ class ReactorRabbitMqTest extends AgentInstrumentationSpecification implements W name 'exchange.declare' kind SpanKind.CLIENT attributes { - // "localhost" on linux, "127.0.0.1" on windows - "$SemanticAttributes.NET_PEER_NAME" { it == "localhost" || it == "127.0.0.1" || it == "0:0:0:0:0:0:0:1" } - "$SemanticAttributes.NET_PEER_PORT" Long "net.sock.peer.addr" { it == "127.0.0.1" || it == "0:0:0:0:0:0:0:1" || it == null } + "net.sock.peer.port" Long "net.sock.family" { it == null || it == "inet6" } "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" diff --git a/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/groovy/server/RatpackRoutesTest.groovy b/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/groovy/server/RatpackRoutesTest.groovy index d2846e0d0f40..e52bd4f93c1e 100644 --- a/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/groovy/server/RatpackRoutesTest.groovy +++ b/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/groovy/server/RatpackRoutesTest.groovy @@ -5,7 +5,6 @@ package server - import io.opentelemetry.instrumentation.ratpack.server.AbstractRatpackRoutesTest import io.opentelemetry.instrumentation.test.AgentTestTrait import ratpack.server.RatpackServerSpec diff --git a/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/ratpack/RatpackForkedHttpClientTest.java b/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/ratpack/RatpackForkedHttpClientTest.java index ed453607a20d..84dee00acc4e 100644 --- a/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/ratpack/RatpackForkedHttpClientTest.java +++ b/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/ratpack/RatpackForkedHttpClientTest.java @@ -5,13 +5,27 @@ package io.opentelemetry.javaagent.instrumentation.ratpack; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.instrumentation.ratpack.client.AbstractRatpackForkedHttpClientTest; import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import io.opentelemetry.instrumentation.testing.junit.http.HttpClientInstrumentationExtension; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import java.net.URI; +import java.util.HashSet; +import java.util.Set; import org.junit.jupiter.api.extension.RegisterExtension; class RatpackForkedHttpClientTest extends AbstractRatpackForkedHttpClientTest { @RegisterExtension static final InstrumentationExtension testing = HttpClientInstrumentationExtension.forAgent(); + + @Override + protected Set> computeHttpAttributes(URI uri) { + Set> attributes = new HashSet<>(super.computeHttpAttributes(uri)); + // underlying netty instrumentation does not provide these + attributes.remove(SemanticAttributes.NET_PEER_NAME); + attributes.remove(SemanticAttributes.NET_PEER_PORT); + return attributes; + } } diff --git a/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/ratpack/RatpackHttpClientTest.java b/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/ratpack/RatpackHttpClientTest.java index 13b941a21879..19ec05c26707 100644 --- a/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/ratpack/RatpackHttpClientTest.java +++ b/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/ratpack/RatpackHttpClientTest.java @@ -5,13 +5,27 @@ package io.opentelemetry.javaagent.instrumentation.ratpack; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.instrumentation.ratpack.client.AbstractRatpackHttpClientTest; import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import io.opentelemetry.instrumentation.testing.junit.http.HttpClientInstrumentationExtension; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import java.net.URI; +import java.util.HashSet; +import java.util.Set; import org.junit.jupiter.api.extension.RegisterExtension; class RatpackHttpClientTest extends AbstractRatpackHttpClientTest { @RegisterExtension static final InstrumentationExtension testing = HttpClientInstrumentationExtension.forAgent(); + + @Override + protected Set> computeHttpAttributes(URI uri) { + Set> attributes = new HashSet<>(super.computeHttpAttributes(uri)); + // underlying netty instrumentation does not provide these + attributes.remove(SemanticAttributes.NET_PEER_NAME); + attributes.remove(SemanticAttributes.NET_PEER_PORT); + return attributes; + } } diff --git a/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/ratpack/RatpackPooledHttpClientTest.java b/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/ratpack/RatpackPooledHttpClientTest.java index 1b5863d5b0b1..4ebc83c89b26 100644 --- a/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/ratpack/RatpackPooledHttpClientTest.java +++ b/instrumentation/ratpack/ratpack-1.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/ratpack/RatpackPooledHttpClientTest.java @@ -5,13 +5,27 @@ package io.opentelemetry.javaagent.instrumentation.ratpack; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.instrumentation.ratpack.client.AbstractRatpackPooledHttpClientTest; import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import io.opentelemetry.instrumentation.testing.junit.http.HttpClientInstrumentationExtension; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import java.net.URI; +import java.util.HashSet; +import java.util.Set; import org.junit.jupiter.api.extension.RegisterExtension; class RatpackPooledHttpClientTest extends AbstractRatpackPooledHttpClientTest { @RegisterExtension static final InstrumentationExtension testing = HttpClientInstrumentationExtension.forAgent(); + + @Override + protected Set> computeHttpAttributes(URI uri) { + Set> attributes = new HashSet<>(super.computeHttpAttributes(uri)); + // underlying netty instrumentation does not provide these + attributes.remove(SemanticAttributes.NET_PEER_NAME); + attributes.remove(SemanticAttributes.NET_PEER_PORT); + return attributes; + } } 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 7dc4910c903b..36fb8115aa79 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 @@ -6,6 +6,7 @@ package io.opentelemetry.instrumentation.ratpack.server import io.opentelemetry.instrumentation.test.InstrumentationSpecification +import io.opentelemetry.instrumentation.test.asserts.AttributesAssert import io.opentelemetry.instrumentation.test.utils.PortUtils import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.testing.internal.armeria.client.WebClient @@ -96,8 +97,13 @@ abstract class AbstractRatpackRoutesTest extends InstrumentationSpecification { hasNoParent() attributes { "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" { it == "localhost" || it == null } + "$SemanticAttributes.NET_HOST_PORT" { it instanceof Long || it == null } "net.sock.peer.addr" { it == "127.0.0.1" || it == null } - "net.sock.peer.port" Long + "net.sock.peer.port" { it instanceof Long || it == null } + "net.sock.host.addr" { it == "127.0.0.1" || it == null } + "net.sock.host.name" { it == "localhost" || it == "127.0.0.1" || it == null } + "net.sock.host.port" { it instanceof Long || it == null } "$SemanticAttributes.HTTP_METHOD" "GET" "$SemanticAttributes.HTTP_STATUS_CODE" 200 diff --git a/instrumentation/ratpack/ratpack-1.4/testing/src/main/java/io/opentelemetry/instrumentation/ratpack/client/AbstractRatpackHttpClientTest.java b/instrumentation/ratpack/ratpack-1.4/testing/src/main/java/io/opentelemetry/instrumentation/ratpack/client/AbstractRatpackHttpClientTest.java index 010bcb1ece39..53d0df256874 100644 --- a/instrumentation/ratpack/ratpack-1.4/testing/src/main/java/io/opentelemetry/instrumentation/ratpack/client/AbstractRatpackHttpClientTest.java +++ b/instrumentation/ratpack/ratpack-1.4/testing/src/main/java/io/opentelemetry/instrumentation/ratpack/client/AbstractRatpackHttpClientTest.java @@ -7,12 +7,14 @@ import io.netty.channel.ConnectTimeoutException; import io.netty.handler.timeout.ReadTimeoutException; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpClientTest; import io.opentelemetry.instrumentation.testing.junit.http.HttpClientTestOptions; import java.net.URI; import java.time.Duration; import java.util.Collections; import java.util.Map; +import java.util.Set; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.condition.OS; @@ -139,16 +141,7 @@ protected void configure(HttpClientTestOptions options) { return exception; }); - options.setHttpAttributes( - uri -> { - switch (uri.toString()) { - case "http://localhost:61/": // unopened port - case "https://192.0.2.1/": // non routable address - return Collections.emptySet(); - default: - return HttpClientTestOptions.DEFAULT_HTTP_ATTRIBUTES; - } - }); + options.setHttpAttributes(this::computeHttpAttributes); options.disableTestRedirects(); @@ -157,4 +150,14 @@ protected void configure(HttpClientTestOptions options) { options.enableTestReadTimeout(); } + + protected Set> computeHttpAttributes(URI uri) { + switch (uri.toString()) { + case "http://localhost:61/": // unopened port + case "https://192.0.2.1/": // non routable address + return Collections.emptySet(); + default: + return HttpClientTestOptions.DEFAULT_HTTP_ATTRIBUTES; + } + } } diff --git a/instrumentation/ratpack/ratpack-1.7/library/src/test/groovy/io/opentelemetry/instrumentation/ratpack/server/RatpackRoutesTest.groovy b/instrumentation/ratpack/ratpack-1.7/library/src/test/groovy/io/opentelemetry/instrumentation/ratpack/server/RatpackRoutesTest.groovy index 0498f3bd2171..e714669f29ea 100644 --- a/instrumentation/ratpack/ratpack-1.7/library/src/test/groovy/io/opentelemetry/instrumentation/ratpack/server/RatpackRoutesTest.groovy +++ b/instrumentation/ratpack/ratpack-1.7/library/src/test/groovy/io/opentelemetry/instrumentation/ratpack/server/RatpackRoutesTest.groovy @@ -5,7 +5,6 @@ package io.opentelemetry.instrumentation.ratpack.server - import io.opentelemetry.instrumentation.ratpack.RatpackTelemetry import io.opentelemetry.instrumentation.test.LibraryTestTrait import ratpack.server.RatpackServerSpec diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-0.9/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/reactornetty/v0_9/AbstractReactorNettyHttpClientTest.groovy b/instrumentation/reactor/reactor-netty/reactor-netty-0.9/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/reactornetty/v0_9/AbstractReactorNettyHttpClientTest.groovy index bd2b38e5c902..42e99ae013f1 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-0.9/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/reactornetty/v0_9/AbstractReactorNettyHttpClientTest.groovy +++ b/instrumentation/reactor/reactor-netty/reactor-netty-0.9/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/reactornetty/v0_9/AbstractReactorNettyHttpClientTest.groovy @@ -13,6 +13,7 @@ import io.opentelemetry.instrumentation.test.AgentTestTrait import io.opentelemetry.instrumentation.test.base.HttpClientTest import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpClientTest import io.opentelemetry.sdk.trace.data.SpanData +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import reactor.netty.http.client.HttpClient import java.util.concurrent.CountDownLatch @@ -100,7 +101,10 @@ abstract class AbstractReactorNettyHttpClientTest extends HttpClientTest { - // unopened port or non routable address - if ("http://localhost:61/".equals(uri.toString()) - || "https://192.0.2.1/".equals(uri.toString())) { - return emptySet(); - } + options.setHttpAttributes(this::getHttpAttributes); + } - Set> attributes = - new HashSet<>(HttpClientTestOptions.DEFAULT_HTTP_ATTRIBUTES); - if (uri.toString().contains("/read-timeout")) { - attributes.remove(SemanticAttributes.NET_PEER_NAME); - attributes.remove(SemanticAttributes.NET_PEER_PORT); - attributes.remove(SemanticAttributes.HTTP_FLAVOR); - } - return attributes; - }); + protected Set> getHttpAttributes(URI uri) { + // unopened port or non routable address + if ("http://localhost:61/".equals(uri.toString()) + || "https://192.0.2.1/".equals(uri.toString())) { + return emptySet(); + } + + Set> attributes = new HashSet<>(HttpClientTestOptions.DEFAULT_HTTP_ATTRIBUTES); + if (uri.toString().contains("/read-timeout")) { + attributes.remove(SemanticAttributes.NET_PEER_NAME); + attributes.remove(SemanticAttributes.NET_PEER_PORT); + attributes.remove(SemanticAttributes.HTTP_FLAVOR); + } + return attributes; } @Test diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyClientSslTest.java b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyClientSslTest.java index 962793afc732..ebd77be51e24 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyClientSslTest.java +++ b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyClientSslTest.java @@ -5,6 +5,7 @@ package io.opentelemetry.javaagent.instrumentation.reactornetty.v1_0; +import static io.opentelemetry.api.common.AttributeKey.longKey; import static io.opentelemetry.api.common.AttributeKey.stringKey; import static io.opentelemetry.api.trace.SpanKind.CLIENT; import static io.opentelemetry.api.trace.SpanKind.INTERNAL; @@ -92,7 +93,9 @@ void shouldFailSslHandshake() throws SSLException { .hasEventsSatisfying(ReactorNettyClientSslTest::isSslHandshakeException) .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.HTTP_METHOD, "GET"), - equalTo(SemanticAttributes.HTTP_URL, uri)), + equalTo(SemanticAttributes.HTTP_URL, uri), + equalTo(SemanticAttributes.NET_PEER_NAME, "localhost"), + equalTo(SemanticAttributes.NET_PEER_PORT, server.httpsPort())), span -> span.hasName("RESOLVE") .hasKind(INTERNAL) @@ -120,9 +123,9 @@ void shouldFailSslHandshake() throws SSLException { .hasEventsSatisfying(ReactorNettyClientSslTest::isSslHandshakeException) .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.NET_TRANSPORT, IP_TCP), - equalTo(SemanticAttributes.NET_PEER_NAME, "localhost"), - equalTo(SemanticAttributes.NET_PEER_PORT, server.httpsPort()), - equalTo(stringKey("net.sock.peer.addr"), "127.0.0.1")))); + equalTo(stringKey("net.sock.peer.addr"), "127.0.0.1"), + equalTo(stringKey("net.sock.peer.name"), "localhost"), + equalTo(longKey("net.sock.peer.port"), server.httpsPort())))); } @Test @@ -184,9 +187,9 @@ void shouldSuccessfullyEstablishSslHandshake() throws SSLException { .hasParent(trace.getSpan(1)) .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.NET_TRANSPORT, IP_TCP), - equalTo(SemanticAttributes.NET_PEER_NAME, "localhost"), - equalTo(SemanticAttributes.NET_PEER_PORT, server.httpsPort()), - equalTo(stringKey("net.sock.peer.addr"), "127.0.0.1")), + equalTo(stringKey("net.sock.peer.addr"), "127.0.0.1"), + equalTo(stringKey("net.sock.peer.name"), "localhost"), + equalTo(longKey("net.sock.peer.port"), server.httpsPort())), span -> span.hasName("test-http-server").hasKind(SERVER).hasParent(trace.getSpan(1)))); } diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyConnectionSpanTest.java b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyConnectionSpanTest.java index 8da1c1cd61de..1eadacd3d9ea 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyConnectionSpanTest.java +++ b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyConnectionSpanTest.java @@ -153,7 +153,9 @@ void testFailingRequest() { .hasException(connectException) .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.HTTP_METHOD, "GET"), - equalTo(SemanticAttributes.HTTP_URL, uri)), + equalTo(SemanticAttributes.HTTP_URL, uri), + equalTo(SemanticAttributes.NET_PEER_NAME, "localhost"), + equalTo(SemanticAttributes.NET_PEER_PORT, PortUtils.UNUSABLE_PORT)), span -> span.hasName("RESOLVE") .hasKind(INTERNAL) @@ -172,6 +174,8 @@ void testFailingRequest() { equalTo(SemanticAttributes.NET_TRANSPORT, IP_TCP), equalTo(SemanticAttributes.NET_PEER_NAME, "localhost"), equalTo(SemanticAttributes.NET_PEER_PORT, PortUtils.UNUSABLE_PORT), - equalTo(stringKey("net.sock.peer.addr"), "127.0.0.1")))); + satisfies( + stringKey("net.sock.peer.addr"), + val -> val.isIn(null, "127.0.0.1"))))); } } diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyHttpClientTest.java b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyHttpClientTest.java index 9fe4971bc058..02b368fd23e7 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyHttpClientTest.java +++ b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyHttpClientTest.java @@ -6,8 +6,13 @@ package io.opentelemetry.javaagent.instrumentation.reactornetty.v1_0; import io.netty.channel.ChannelOption; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.instrumentation.testing.junit.http.HttpClientTestOptions; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import io.opentelemetry.testing.internal.armeria.common.HttpHeaderNames; +import java.net.URI; +import java.util.HashSet; +import java.util.Set; import reactor.netty.http.client.HttpClient; class ReactorNettyHttpClientTest extends AbstractReactorNettyHttpClientTest { @@ -48,4 +53,18 @@ protected void configure(HttpClientTestOptions options) { .code(); }); } + + @Override + protected Set> getHttpAttributes(URI uri) { + if (uri.toString().contains("/success")) { + // the single connection test does not report net.peer.* attributes; it only reports the + // net.peer.sock.* attributes + Set> attributes = + new HashSet<>(HttpClientTestOptions.DEFAULT_HTTP_ATTRIBUTES); + attributes.remove(SemanticAttributes.NET_PEER_NAME); + attributes.remove(SemanticAttributes.NET_PEER_PORT); + return attributes; + } + return super.getHttpAttributes(uri); + } } diff --git a/instrumentation/redisson/redisson-common/testing/src/main/groovy/AbstractRedissonAsyncClientTest.groovy b/instrumentation/redisson/redisson-common/testing/src/main/groovy/AbstractRedissonAsyncClientTest.groovy index a6fdb2e60222..0e80fd983a7f 100644 --- a/instrumentation/redisson/redisson-common/testing/src/main/groovy/AbstractRedissonAsyncClientTest.groovy +++ b/instrumentation/redisson/redisson-common/testing/src/main/groovy/AbstractRedissonAsyncClientTest.groovy @@ -78,10 +78,10 @@ abstract class AbstractRedissonAsyncClientTest extends AgentInstrumentationSpeci name "SET" kind CLIENT attributes { - "$SemanticAttributes.DB_SYSTEM" "redis" - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port + "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET foo ?" "$SemanticAttributes.DB_OPERATION" "SET" } @@ -118,10 +118,10 @@ abstract class AbstractRedissonAsyncClientTest extends AgentInstrumentationSpeci kind CLIENT childOf(span(0)) attributes { - "$SemanticAttributes.DB_SYSTEM" "redis" - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port + "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SADD set1 ?" "$SemanticAttributes.DB_OPERATION" "SADD" } diff --git a/instrumentation/redisson/redisson-common/testing/src/main/groovy/AbstractRedissonClientTest.groovy b/instrumentation/redisson/redisson-common/testing/src/main/groovy/AbstractRedissonClientTest.groovy index 40a2163073d8..d8b79b39f13b 100644 --- a/instrumentation/redisson/redisson-common/testing/src/main/groovy/AbstractRedissonClientTest.groovy +++ b/instrumentation/redisson/redisson-common/testing/src/main/groovy/AbstractRedissonClientTest.groovy @@ -77,10 +77,10 @@ abstract class AbstractRedissonClientTest extends AgentInstrumentationSpecificat name "SET" kind CLIENT attributes { - "$SemanticAttributes.DB_SYSTEM" "redis" - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port + "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET foo ?" "$SemanticAttributes.DB_OPERATION" "SET" } @@ -91,10 +91,10 @@ abstract class AbstractRedissonClientTest extends AgentInstrumentationSpecificat name "GET" kind CLIENT attributes { - "$SemanticAttributes.DB_SYSTEM" "redis" - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port + "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "GET foo" "$SemanticAttributes.DB_OPERATION" "GET" } @@ -117,10 +117,10 @@ abstract class AbstractRedissonClientTest extends AgentInstrumentationSpecificat name "DB Query" kind CLIENT attributes { - "$SemanticAttributes.DB_SYSTEM" "redis" - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port + "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SET batch1 ?;SET batch2 ?" "$SemanticAttributes.DB_OPERATION" null } @@ -141,10 +141,10 @@ abstract class AbstractRedissonClientTest extends AgentInstrumentationSpecificat name "RPUSH" kind CLIENT attributes { - "$SemanticAttributes.DB_SYSTEM" "redis" - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port + "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "RPUSH list1 ?" "$SemanticAttributes.DB_OPERATION" "RPUSH" } @@ -168,10 +168,10 @@ abstract class AbstractRedissonClientTest extends AgentInstrumentationSpecificat name "EVAL" kind CLIENT attributes { - "$SemanticAttributes.DB_SYSTEM" "redis" - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port + "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "EVAL $script 1 map1 ? ?" "$SemanticAttributes.DB_OPERATION" "EVAL" } @@ -182,10 +182,10 @@ abstract class AbstractRedissonClientTest extends AgentInstrumentationSpecificat name "HGET" kind CLIENT attributes { - "$SemanticAttributes.DB_SYSTEM" "redis" - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port + "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "HGET map1 key1" "$SemanticAttributes.DB_OPERATION" "HGET" } @@ -206,10 +206,10 @@ abstract class AbstractRedissonClientTest extends AgentInstrumentationSpecificat name "SADD" kind CLIENT attributes { - "$SemanticAttributes.DB_SYSTEM" "redis" - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port + "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "SADD set1 ?" "$SemanticAttributes.DB_OPERATION" "SADD" } @@ -234,10 +234,10 @@ abstract class AbstractRedissonClientTest extends AgentInstrumentationSpecificat name "ZADD" kind CLIENT attributes { - "$SemanticAttributes.DB_SYSTEM" "redis" - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port + "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "ZADD sort_set1 ? ? ? ? ? ?" "$SemanticAttributes.DB_OPERATION" "ZADD" } @@ -258,10 +258,10 @@ abstract class AbstractRedissonClientTest extends AgentInstrumentationSpecificat name "INCR" kind CLIENT attributes { - "$SemanticAttributes.DB_SYSTEM" "redis" - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port + "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" "INCR AtomicLong" "$SemanticAttributes.DB_OPERATION" "INCR" } @@ -287,10 +287,10 @@ abstract class AbstractRedissonClientTest extends AgentInstrumentationSpecificat name "EVAL" kind CLIENT attributes { - "$SemanticAttributes.DB_SYSTEM" "redis" - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port + "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" { lockScriptPattern.matcher(it).matches() } "$SemanticAttributes.DB_OPERATION" "EVAL" } @@ -303,10 +303,10 @@ abstract class AbstractRedissonClientTest extends AgentInstrumentationSpecificat name "EVAL" kind CLIENT attributes { - "$SemanticAttributes.DB_SYSTEM" "redis" - "$SemanticAttributes.NET_PEER_NAME" "localhost" - "$SemanticAttributes.NET_PEER_PORT" port "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.name" "localhost" + "net.sock.peer.port" port + "$SemanticAttributes.DB_SYSTEM" "redis" "$SemanticAttributes.DB_STATEMENT" { lockScriptPattern.matcher(it).matches() } "$SemanticAttributes.DB_OPERATION" "EVAL" } diff --git a/instrumentation/spark-2.3/javaagent/src/test/groovy/SparkJavaBasedTest.groovy b/instrumentation/spark-2.3/javaagent/src/test/groovy/SparkJavaBasedTest.groovy index 3395cc74e68c..1257c6e9e8d0 100644 --- a/instrumentation/spark-2.3/javaagent/src/test/groovy/SparkJavaBasedTest.groovy +++ b/instrumentation/spark-2.3/javaagent/src/test/groovy/SparkJavaBasedTest.groovy @@ -47,9 +47,6 @@ class SparkJavaBasedTest extends AgentInstrumentationSpecification { kind SERVER hasNoParent() attributes { - "$SemanticAttributes.NET_TRANSPORT" IP_TCP - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_HOST" "localhost:$port" "$SemanticAttributes.HTTP_TARGET" "/param/asdf1234" @@ -58,6 +55,13 @@ class SparkJavaBasedTest extends AgentInstrumentationSpecification { "$SemanticAttributes.HTTP_FLAVOR" "1.1" "$SemanticAttributes.HTTP_USER_AGENT" String "$SemanticAttributes.HTTP_ROUTE" "/param/:param" + "$SemanticAttributes.NET_TRANSPORT" IP_TCP + "$SemanticAttributes.NET_HOST_NAME" "localhost" + "$SemanticAttributes.NET_HOST_PORT" port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" "127.0.0.1" } } } diff --git a/instrumentation/spring/spring-integration-4.1/javaagent/src/test/groovy/SpringIntegrationAndRabbitTest.groovy b/instrumentation/spring/spring-integration-4.1/javaagent/src/test/groovy/SpringIntegrationAndRabbitTest.groovy index 96cf998ce7e0..67ef09e2b9ba 100644 --- a/instrumentation/spring/spring-integration-4.1/javaagent/src/test/groovy/SpringIntegrationAndRabbitTest.groovy +++ b/instrumentation/spring/spring-integration-4.1/javaagent/src/test/groovy/SpringIntegrationAndRabbitTest.groovy @@ -46,10 +46,8 @@ class SpringIntegrationAndRabbitTest extends AgentInstrumentationSpecification i childOf span(1) kind CLIENT attributes { - // "localhost" on linux, "127.0.0.1" on windows - "$SemanticAttributes.NET_PEER_NAME" { it == "localhost" || it == "127.0.0.1" || it == "0:0:0:0:0:0:0:1" } - "$SemanticAttributes.NET_PEER_PORT" Long "net.sock.peer.addr" { it == "127.0.0.1" || it == "0:0:0:0:0:0:0:1" || it == null } + "net.sock.peer.port" Long "net.sock.family" { it == null || it == "inet6" } "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" @@ -61,10 +59,8 @@ class SpringIntegrationAndRabbitTest extends AgentInstrumentationSpecification i childOf span(1) kind PRODUCER attributes { - // "localhost" on linux, "127.0.0.1" on windows - "$SemanticAttributes.NET_PEER_NAME" { it == "localhost" || it == "127.0.0.1" || it == "0:0:0:0:0:0:0:1" } - "$SemanticAttributes.NET_PEER_PORT" Long "net.sock.peer.addr" { it == "127.0.0.1" || it == "0:0:0:0:0:0:0:1" || it == null } + "net.sock.peer.port" Long "net.sock.family" { it == null || it == "inet6" } "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" "$SemanticAttributes.MESSAGING_DESTINATION" "testTopic" @@ -117,10 +113,8 @@ class SpringIntegrationAndRabbitTest extends AgentInstrumentationSpecification i name "basic.ack" kind CLIENT attributes { - // "localhost" on linux, "127.0.0.1" on windows - "$SemanticAttributes.NET_PEER_NAME" { it == "localhost" || it == "127.0.0.1" || it == "0:0:0:0:0:0:0:1" } - "$SemanticAttributes.NET_PEER_PORT" Long "net.sock.peer.addr" { it == "127.0.0.1" || it == "0:0:0:0:0:0:0:1" || it == null } + "net.sock.peer.port" Long "net.sock.family" { it == null || it == "inet6" } "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" diff --git a/instrumentation/spring/spring-rabbit-1.0/javaagent/src/test/groovy/ContextPropagationTest.groovy b/instrumentation/spring/spring-rabbit-1.0/javaagent/src/test/groovy/ContextPropagationTest.groovy index e69fc60bbd38..cdb076e92493 100644 --- a/instrumentation/spring/spring-rabbit-1.0/javaagent/src/test/groovy/ContextPropagationTest.groovy +++ b/instrumentation/spring/spring-rabbit-1.0/javaagent/src/test/groovy/ContextPropagationTest.groovy @@ -100,10 +100,8 @@ class ContextPropagationTest extends AgentInstrumentationSpecification { kind PRODUCER childOf span(0) attributes { - // "localhost" on linux, "127.0.0.1" on windows - "$SemanticAttributes.NET_PEER_NAME" { it == "localhost" || it == "127.0.0.1" } - "$SemanticAttributes.NET_PEER_PORT" Long "net.sock.peer.addr" { it == "127.0.0.1" || it == null } + "net.sock.peer.port" Long "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" "$SemanticAttributes.MESSAGING_DESTINATION" "" "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" @@ -160,10 +158,8 @@ class ContextPropagationTest extends AgentInstrumentationSpecification { name "basic.ack" kind CLIENT attributes { - // "localhost" on linux, "127.0.0.1" on windows - "$SemanticAttributes.NET_PEER_NAME" { it == "localhost" || it == "127.0.0.1" } - "$SemanticAttributes.NET_PEER_PORT" Long "net.sock.peer.addr" { it == "127.0.0.1" || it == null } + "net.sock.peer.port" Long "$SemanticAttributes.MESSAGING_SYSTEM" "rabbitmq" "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "queue" } diff --git a/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy b/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy index 8368933ee666..a9588d7d4328 100644 --- a/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy +++ b/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy @@ -83,6 +83,9 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_TRANSPORT" IP_TCP "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" { it == "127.0.0.1" || it == "localhost" } + "net.sock.host.port" Long "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:${port}" } "$SemanticAttributes.HTTP_TARGET" urlPath "$SemanticAttributes.HTTP_METHOD" "GET" @@ -151,6 +154,9 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_TRANSPORT" IP_TCP "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" { it == "127.0.0.1" || it == "localhost" } + "net.sock.host.port" Long "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:${port}" } "$SemanticAttributes.HTTP_TARGET" urlPath "$SemanticAttributes.HTTP_METHOD" "GET" @@ -239,6 +245,9 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_TRANSPORT" IP_TCP "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" { it == "127.0.0.1" || it == "localhost" } + "net.sock.host.port" Long "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:${port}" } "$SemanticAttributes.HTTP_TARGET" urlPath "$SemanticAttributes.HTTP_METHOD" "GET" @@ -305,6 +314,9 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_TRANSPORT" IP_TCP "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" { it == "127.0.0.1" || it == "localhost" } + "net.sock.host.port" Long "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:${port}" } "$SemanticAttributes.HTTP_TARGET" "/notfoundgreet" "$SemanticAttributes.HTTP_METHOD" "GET" @@ -350,6 +362,9 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_TRANSPORT" IP_TCP "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" { it == "127.0.0.1" || it == "localhost" } + "net.sock.host.port" Long "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:${port}" } "$SemanticAttributes.HTTP_TARGET" "/echo" "$SemanticAttributes.HTTP_METHOD" "POST" @@ -400,6 +415,9 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_TRANSPORT" IP_TCP "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" { it == "127.0.0.1" || it == "localhost" } + "net.sock.host.port" Long "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:${port}" } "$SemanticAttributes.HTTP_TARGET" urlPath "$SemanticAttributes.HTTP_METHOD" "GET" @@ -465,6 +483,9 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_TRANSPORT" IP_TCP "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" { it == "127.0.0.1" || it == "localhost" } + "net.sock.host.port" Long "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:${port}" } "$SemanticAttributes.HTTP_TARGET" "/double-greet-redirect" "$SemanticAttributes.HTTP_METHOD" "GET" @@ -498,6 +519,9 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_TRANSPORT" IP_TCP "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" { it == "127.0.0.1" || it == "localhost" } + "net.sock.host.port" Long "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:${port}" } "$SemanticAttributes.HTTP_TARGET" "/double-greet" "$SemanticAttributes.HTTP_METHOD" "GET" @@ -546,6 +570,9 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_TRANSPORT" IP_TCP "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" { it == "127.0.0.1" || it == "localhost" } + "net.sock.host.port" Long "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:${port}" } "$SemanticAttributes.HTTP_TARGET" urlPath "$SemanticAttributes.HTTP_METHOD" "GET" diff --git a/instrumentation/undertow-1.4/javaagent/src/test/groovy/UndertowServerTest.groovy b/instrumentation/undertow-1.4/javaagent/src/test/groovy/UndertowServerTest.groovy index 95931cdaad3c..2bb8f491da5d 100644 --- a/instrumentation/undertow-1.4/javaagent/src/test/groovy/UndertowServerTest.groovy +++ b/instrumentation/undertow-1.4/javaagent/src/test/groovy/UndertowServerTest.groovy @@ -138,8 +138,6 @@ class UndertowServerTest extends HttpServerTest implements AgentTestTr } attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_CLIENT_IP" TEST_CLIENT_IP "$SemanticAttributes.HTTP_SCHEME" uri.getScheme() "$SemanticAttributes.HTTP_HOST" uri.getHost() + ":" + uri.getPort() @@ -153,6 +151,12 @@ class UndertowServerTest extends HttpServerTest implements AgentTestTr "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_TARGET" "/sendResponse" "$SemanticAttributes.NET_TRANSPORT" SemanticAttributes.NetTransportValues.IP_TCP + "$SemanticAttributes.NET_HOST_NAME" uri.host + "$SemanticAttributes.NET_HOST_PORT" uri.port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" "127.0.0.1" } } span(1) { @@ -191,8 +195,6 @@ class UndertowServerTest extends HttpServerTest implements AgentTestTr errorEvent(Exception, "exception after sending response", 2) attributes { - "net.sock.peer.addr" "127.0.0.1" - "net.sock.peer.port" Long "$SemanticAttributes.HTTP_CLIENT_IP" TEST_CLIENT_IP "$SemanticAttributes.HTTP_SCHEME" uri.getScheme() "$SemanticAttributes.HTTP_HOST" uri.getHost() + ":" + uri.getPort() @@ -206,6 +208,12 @@ class UndertowServerTest extends HttpServerTest implements AgentTestTr "$SemanticAttributes.HTTP_SCHEME" "http" "$SemanticAttributes.HTTP_TARGET" "/sendResponseWithException" "$SemanticAttributes.NET_TRANSPORT" SemanticAttributes.NetTransportValues.IP_TCP + "$SemanticAttributes.NET_HOST_NAME" uri.host + "$SemanticAttributes.NET_HOST_PORT" uri.port + "net.sock.peer.addr" "127.0.0.1" + "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" "127.0.0.1" } } span(1) { 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 83d2150fe6fa..83445162773e 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 @@ -66,6 +66,9 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_TRANSPORT" IP_TCP "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" { it == "127.0.0.1" || it == "localhost" } + "net.sock.host.port" Long "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:${port}" } "$SemanticAttributes.HTTP_TARGET" "/listProducts" "$SemanticAttributes.HTTP_METHOD" "GET" @@ -157,6 +160,9 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_TRANSPORT" IP_TCP "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" { it == "127.0.0.1" || it == "localhost" } + "net.sock.host.port" Long "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:${port}" } "$SemanticAttributes.HTTP_TARGET" "$baseUrl?$TEST_REQUEST_ID_PARAMETER=$requestId" "$SemanticAttributes.HTTP_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 83d2150fe6fa..83445162773e 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 @@ -66,6 +66,9 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_TRANSPORT" IP_TCP "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" { it == "127.0.0.1" || it == "localhost" } + "net.sock.host.port" Long "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:${port}" } "$SemanticAttributes.HTTP_TARGET" "/listProducts" "$SemanticAttributes.HTTP_METHOD" "GET" @@ -157,6 +160,9 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification { "$SemanticAttributes.NET_TRANSPORT" IP_TCP "net.sock.peer.addr" "127.0.0.1" "net.sock.peer.port" Long + "net.sock.host.addr" "127.0.0.1" + "net.sock.host.name" { it == "127.0.0.1" || it == "localhost" } + "net.sock.host.port" Long "$SemanticAttributes.HTTP_HOST" { it == "localhost" || it == "localhost:${port}" } "$SemanticAttributes.HTTP_TARGET" "$baseUrl?$TEST_REQUEST_ID_PARAMETER=$requestId" "$SemanticAttributes.HTTP_METHOD" "GET" diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy index 6db401d956e8..8f00aa6cfed0 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy @@ -199,6 +199,9 @@ abstract class HttpServerTest extends InstrumentationSpecification imple options.hasExceptionOnServerSpan = { endpoint -> HttpServerTest.this.hasExceptionOnServerSpan(endpoint) } + options.sockPeerAddr = { endpoint -> + HttpServerTest.this.peerIp(endpoint) + } options.testRedirect = testRedirect() options.testError = testError() diff --git a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java index 911042ffd414..5aad78a2c5fc 100644 --- a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java +++ b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java @@ -6,6 +6,7 @@ package io.opentelemetry.instrumentation.testing.junit.http; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; +import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NetTransportValues.IP_TCP; import static org.assertj.core.api.Assertions.catchThrowable; import static org.junit.jupiter.api.Assumptions.assumeTrue; @@ -912,10 +913,14 @@ SpanDataAssert assertClientSpan( .hasKind(SpanKind.CLIENT) .hasAttributesSatisfying( attrs -> { + // TODO: Move to test knob rather than always treating as optional + if (attrs.get(SemanticAttributes.NET_TRANSPORT) != null) { + assertThat(attrs).containsEntry(SemanticAttributes.NET_TRANSPORT, IP_TCP); + } + if (uri.getPort() == PortUtils.UNUSABLE_PORT || uri.getHost().equals("192.0.2.1")) { - // TODO(anuraaga): For theses cases, there isn't actually a peer so we shouldn't be - // filling in peer information but some instrumentation does so based on the URL - // itself which is present in HTTP attributes. We should fix this. + // TODO: net.peer.name and net.peer.port should always be populated from the URI or + // the Host header, verify these assertions below if (attrs.asMap().containsKey(SemanticAttributes.NET_PEER_NAME)) { assertThat(attrs).containsEntry(SemanticAttributes.NET_PEER_NAME, uri.getHost()); } @@ -937,6 +942,17 @@ SpanDataAssert assertClientSpan( }); } } + + // In theses cases the peer connection is not established, so the HTTP client should + // not report any socket-level attributes + // TODO https://github.com/open-telemetry/opentelemetry-java/pull/4723 + assertThat(attrs.asMap()) + .doesNotContainKey(AttributeKey.stringKey("net.sock.family")) + // TODO netty sometimes reports net.sock.peer.addr in connection error test + // .doesNotContainKey(AttributeKey.stringKey("net.sock.peer.addr")) + .doesNotContainKey(AttributeKey.stringKey("net.sock.peer.name")) + .doesNotContainKey(AttributeKey.stringKey("net.sock.peer.port")); + } else { if (httpClientAttributes.contains(SemanticAttributes.NET_PEER_NAME)) { assertThat(attrs).containsEntry(SemanticAttributes.NET_PEER_NAME, uri.getHost()); @@ -944,19 +960,18 @@ SpanDataAssert assertClientSpan( if (httpClientAttributes.contains(SemanticAttributes.NET_PEER_PORT)) { assertThat(attrs).containsEntry(SemanticAttributes.NET_PEER_PORT, uri.getPort()); } - } - // TODO(anuraaga): Move to test knob rather than always treating as optional - if (attrs.asMap().containsKey(AttributeKey.stringKey("net.sock.peer.addr"))) { - if (uri.getHost().equals("192.0.2.1")) { - // NB(anuraaga): This branch seems to currently only be exercised on Java 15. - // It would be good to understand how the JVM version is impacting this check. - assertThat(attrs) - .containsEntry(AttributeKey.stringKey("net.sock.peer.addr"), "192.0.2.1"); - } else { + // TODO: Move to test knob rather than always treating as optional + if (attrs.asMap().containsKey(AttributeKey.stringKey("net.sock.peer.addr"))) { assertThat(attrs) .containsEntry(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"); } + if (attrs.asMap().containsKey(AttributeKey.stringKey("net.sock.peer.port"))) { + assertThat(attrs) + .containsEntry( + AttributeKey.longKey("net.sock.peer.port"), + "https".equals(uri.getScheme()) ? server.httpsPort() : server.httpPort()); + } } if (httpClientAttributes.contains(SemanticAttributes.HTTP_URL)) { diff --git a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpServerTest.java b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpServerTest.java index 4c14cd588737..34626a340041 100644 --- a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpServerTest.java +++ b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpServerTest.java @@ -551,7 +551,15 @@ protected SpanDataAssert assertServerSpan( .containsEntry( SemanticAttributes.NET_TRANSPORT, SemanticAttributes.NetTransportValues.IP_TCP); } - if (httpAttributes.contains(AttributeKey.longKey("net.sock.peer.port"))) { + + // TODO: Move to test knob rather than always treating as optional + if (attrs.get(SemanticAttributes.NET_HOST_NAME) != null) { + assertThat(attrs).containsEntry(SemanticAttributes.NET_HOST_NAME, "localhost"); + } + if (attrs.get(SemanticAttributes.NET_HOST_PORT) != null) { + assertThat(attrs).containsEntry(SemanticAttributes.NET_HOST_PORT, port); + } + if (attrs.get(AttributeKey.longKey("net.sock.peer.port")) != null) { assertThat(attrs) .hasEntrySatisfying( AttributeKey.longKey("net.sock.peer.port"), @@ -560,12 +568,16 @@ protected SpanDataAssert assertServerSpan( .isInstanceOf(Long.class) .isNotEqualTo(Long.valueOf(port))); } - if (httpAttributes.contains(AttributeKey.stringKey("net.sock.peer.addr"))) { + if (attrs.get(AttributeKey.stringKey("net.sock.peer.addr")) != null) { assertThat(attrs) .containsEntry( AttributeKey.stringKey("net.sock.peer.addr"), options.sockPeerAddr.apply(endpoint)); } + if (attrs.get(AttributeKey.stringKey("net.sock.host.addr")) != null) { + assertThat(attrs) + .containsEntry(AttributeKey.stringKey("net.sock.host.addr"), "127.0.0.1"); + } assertThat(attrs) .hasEntrySatisfying(