diff --git a/benchmark/src/jmh/java/io/opentelemetry/benchmark/InstrumenterBenchmark.java b/benchmark/src/jmh/java/io/opentelemetry/benchmark/InstrumenterBenchmark.java index dae6b51575f1..d4d3d9afadad 100644 --- a/benchmark/src/jmh/java/io/opentelemetry/benchmark/InstrumenterBenchmark.java +++ b/benchmark/src/jmh/java/io/opentelemetry/benchmark/InstrumenterBenchmark.java @@ -110,6 +110,10 @@ static class ConstantNetAttributesExtractor private static final InetSocketAddress ADDRESS = InetSocketAddress.createUnresolved("localhost", 8080); + protected ConstantNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public @Nullable InetSocketAddress getAddress(Void unused, @Nullable Void unused2) { return ADDRESS; diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetAttributesExtractor.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetAttributesExtractor.java index 2047b0239e67..0bef0a79cec7 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetAttributesExtractor.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetAttributesExtractor.java @@ -19,6 +19,15 @@ public abstract class InetSocketAddressNetAttributesExtractor extends NetAttributesExtractor { + protected InetSocketAddressNetAttributesExtractor() { + this(NetPeerAttributeExtraction.ON_BOTH); + } + + protected InetSocketAddressNetAttributesExtractor( + NetPeerAttributeExtraction netPeerAttributeExtraction) { + super(netPeerAttributeExtraction); + } + /** * This method will be called twice: both when the request starts ({@code response} is always null * then) and when the response ends. This way it is possible to capture net attributes in both diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetAttributesExtractor.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetAttributesExtractor.java index 1a19303c5587..ec4f57c1bdd9 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetAttributesExtractor.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetAttributesExtractor.java @@ -19,10 +19,24 @@ public abstract class NetAttributesExtractor extends AttributesExtractor { + private final NetPeerAttributeExtraction netPeerAttributeExtraction; + + protected NetAttributesExtractor() { + this(NetPeerAttributeExtraction.ON_BOTH); + } + + protected NetAttributesExtractor(NetPeerAttributeExtraction netPeerAttributeExtraction) { + this.netPeerAttributeExtraction = netPeerAttributeExtraction; + } + @Override protected final void onStart(AttributesBuilder attributes, REQUEST request) { set(attributes, SemanticAttributes.NET_TRANSPORT, transport(request)); + if (netPeerAttributeExtraction == NetPeerAttributeExtraction.ON_END) { + return; + } + String peerIp = peerIp(request, null); String peerName = peerName(request, null); @@ -44,6 +58,10 @@ protected final void onEnd( @Nullable RESPONSE response, @Nullable Throwable error) { + if (netPeerAttributeExtraction == NetPeerAttributeExtraction.ON_START) { + return; + } + String peerIp = peerIp(request, response); String peerName = peerName(request, response); @@ -84,4 +102,10 @@ protected final void onEnd( */ @Nullable public abstract String peerIp(REQUEST request, @Nullable RESPONSE response); + + public enum NetPeerAttributeExtraction { + ON_START, + ON_END, + ON_BOTH + } } diff --git a/instrumentation/apache-dubbo-2.7/library/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/internal/DubboNetAttributesExtractor.java b/instrumentation/apache-dubbo-2.7/library/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/internal/DubboNetAttributesExtractor.java index 2c42ab5c4081..d27a23a5e8f2 100644 --- a/instrumentation/apache-dubbo-2.7/library/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/internal/DubboNetAttributesExtractor.java +++ b/instrumentation/apache-dubbo-2.7/library/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/internal/DubboNetAttributesExtractor.java @@ -14,6 +14,10 @@ public final class DubboNetAttributesExtractor extends InetSocketAddressNetAttributesExtractor { + public DubboNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public @Nullable InetSocketAddress getAddress(DubboRequest request, @Nullable Result result) { return request.context().getRemoteAddress(); diff --git a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientNetAttributesExtractor.java b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientNetAttributesExtractor.java index 7233ae17c35b..4d622f31e5b0 100644 --- a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientNetAttributesExtractor.java +++ b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientNetAttributesExtractor.java @@ -13,6 +13,10 @@ final class ApacheHttpAsyncClientNetAttributesExtractor extends NetAttributesExtractor { + ApacheHttpAsyncClientNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(ApacheHttpClientRequest request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientNetAttributesExtractor.java b/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientNetAttributesExtractor.java index d8c1ce772d0a..2cc905d73725 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientNetAttributesExtractor.java +++ b/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientNetAttributesExtractor.java @@ -14,6 +14,10 @@ final class ApacheHttpClientNetAttributesExtractor extends NetAttributesExtractor { + ApacheHttpClientNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(HttpMethod request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientNetAttributesExtractor.java b/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientNetAttributesExtractor.java index 31684c16739c..b826a6e4a79d 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientNetAttributesExtractor.java +++ b/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientNetAttributesExtractor.java @@ -13,6 +13,10 @@ final class ApacheHttpClientNetAttributesExtractor extends NetAttributesExtractor { + ApacheHttpClientNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(ApacheHttpClientRequest request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientNetAttributesExtractor.java b/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientNetAttributesExtractor.java index 69458f393cef..26589b575da6 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientNetAttributesExtractor.java +++ b/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientNetAttributesExtractor.java @@ -13,6 +13,10 @@ final class ApacheHttpClientNetAttributesExtractor extends NetAttributesExtractor { + ApacheHttpClientNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(ApacheHttpClientRequest request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientNetAttributesExtractor.java b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientNetAttributesExtractor.java index 951330a4a47b..82f0e27db7fa 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientNetAttributesExtractor.java +++ b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientNetAttributesExtractor.java @@ -19,6 +19,10 @@ final class ApacheHttpClientNetAttributesExtractor private static final Logger logger = LoggerFactory.getLogger(ApacheHttpClientNetAttributesExtractor.class); + ApacheHttpClientNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(ClassicHttpRequest request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/internal/ArmeriaNetAttributesExtractor.java b/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/internal/ArmeriaNetAttributesExtractor.java index d7ae326e66ae..8c98a9e50383 100644 --- a/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/internal/ArmeriaNetAttributesExtractor.java +++ b/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/internal/ArmeriaNetAttributesExtractor.java @@ -16,6 +16,10 @@ public final class ArmeriaNetAttributesExtractor extends InetSocketAddressNetAttributesExtractor { + public ArmeriaNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_END); + } + @Override public String transport(RequestContext ctx) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientNetAttributesExtractor.java b/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientNetAttributesExtractor.java index b4dc9a99f2f4..fedc21192813 100644 --- a/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientNetAttributesExtractor.java +++ b/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientNetAttributesExtractor.java @@ -14,6 +14,10 @@ final class AsyncHttpClientNetAttributesExtractor extends NetAttributesExtractor { + AsyncHttpClientNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(Request request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientNetAttributesExtractor.java b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientNetAttributesExtractor.java index 7af67b2d8d66..dd675ac76ce3 100644 --- a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientNetAttributesExtractor.java +++ b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientNetAttributesExtractor.java @@ -14,6 +14,10 @@ final class AsyncHttpClientNetAttributesExtractor extends InetSocketAddressNetAttributesExtractor { + AsyncHttpClientNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_END); + } + @Override public String transport(RequestContext requestContext) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraNetAttributesExtractor.java b/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraNetAttributesExtractor.java index 191fbe1a65ad..e021d4e1ca91 100644 --- a/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraNetAttributesExtractor.java +++ b/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraNetAttributesExtractor.java @@ -13,6 +13,10 @@ final class CassandraNetAttributesExtractor extends InetSocketAddressNetAttributesExtractor { + CassandraNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_END); + } + @Override @Nullable public String transport(CassandraRequest request) { diff --git a/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraNetAttributesExtractor.java b/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraNetAttributesExtractor.java index 73f0193f4e0b..f96489e2c341 100644 --- a/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraNetAttributesExtractor.java +++ b/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraNetAttributesExtractor.java @@ -15,6 +15,10 @@ final class CassandraNetAttributesExtractor extends InetSocketAddressNetAttributesExtractor { + CassandraNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_END); + } + @Override @Nullable public String transport(CassandraRequest request) { diff --git a/instrumentation/elasticsearch/elasticsearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/ElasticsearchRestNetAttributesExtractor.java b/instrumentation/elasticsearch/elasticsearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/ElasticsearchRestNetAttributesExtractor.java index bda81598bd65..c2a6807778e6 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/ElasticsearchRestNetAttributesExtractor.java +++ b/instrumentation/elasticsearch/elasticsearch-rest-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/ElasticsearchRestNetAttributesExtractor.java @@ -12,6 +12,10 @@ final class ElasticsearchRestNetAttributesExtractor extends NetAttributesExtractor { + ElasticsearchRestNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_END); + } + @Override public String transport(String s) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v6_0/Elasticsearch6TransportNetAttributesExtractor.java b/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v6_0/Elasticsearch6TransportNetAttributesExtractor.java index 324e4be35ad6..dd9190b2f94f 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v6_0/Elasticsearch6TransportNetAttributesExtractor.java +++ b/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v6_0/Elasticsearch6TransportNetAttributesExtractor.java @@ -13,6 +13,11 @@ public class Elasticsearch6TransportNetAttributesExtractor extends InetSocketAddressNetAttributesExtractor { + + public Elasticsearch6TransportNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_END); + } + @Override public @Nullable String transport(ElasticTransportRequest elasticTransportRequest) { return null; diff --git a/instrumentation/elasticsearch/elasticsearch-transport-common/library/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/ElasticTransportNetAttributesExtractor.java b/instrumentation/elasticsearch/elasticsearch-transport-common/library/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/ElasticTransportNetAttributesExtractor.java index ec60e438038c..85ecd6b76a84 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-common/library/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/ElasticTransportNetAttributesExtractor.java +++ b/instrumentation/elasticsearch/elasticsearch-transport-common/library/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/ElasticTransportNetAttributesExtractor.java @@ -11,6 +11,10 @@ public class ElasticTransportNetAttributesExtractor extends NetAttributesExtractor { + public ElasticTransportNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_END); + } + @Override public @Nullable String transport(ElasticTransportRequest elasticTransportRequest) { return null; diff --git a/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientNetAttributesExtractor.java b/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientNetAttributesExtractor.java index a69f7f96436e..0adf36cf185e 100644 --- a/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientNetAttributesExtractor.java +++ b/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientNetAttributesExtractor.java @@ -14,6 +14,10 @@ final class GoogleHttpClientNetAttributesExtractor extends NetAttributesExtractor { + GoogleHttpClientNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(HttpRequest request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/internal/GrpcNetAttributesExtractor.java b/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/internal/GrpcNetAttributesExtractor.java index 4f5b35f4b008..e19bb3571781 100644 --- a/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/internal/GrpcNetAttributesExtractor.java +++ b/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/internal/GrpcNetAttributesExtractor.java @@ -15,6 +15,11 @@ public final class GrpcNetAttributesExtractor extends InetSocketAddressNetAttributesExtractor { + + public GrpcNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override @Nullable public InetSocketAddress getAddress(GrpcRequest request, @Nullable Status status) { diff --git a/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlNetAttributesExtractor.java b/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlNetAttributesExtractor.java index e9e8cc73da72..99e218b59849 100644 --- a/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlNetAttributesExtractor.java +++ b/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlNetAttributesExtractor.java @@ -11,6 +11,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; class HttpUrlNetAttributesExtractor extends NetAttributesExtractor { + HttpUrlNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public @Nullable String transport(HttpURLConnection connection) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/java-http-client/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JdkHttpNetAttributesExtractor.java b/instrumentation/java-http-client/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JdkHttpNetAttributesExtractor.java index 5d78c2647918..ec999490b13a 100644 --- a/instrumentation/java-http-client/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JdkHttpNetAttributesExtractor.java +++ b/instrumentation/java-http-client/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JdkHttpNetAttributesExtractor.java @@ -18,6 +18,10 @@ public class JdkHttpNetAttributesExtractor private static final Logger logger = LoggerFactory.getLogger(JdkHttpNetAttributesExtractor.class); + public JdkHttpNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(HttpRequest httpRequest) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/jaxrs-client/jaxrs-client-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v1_1/JaxRsClientNetAttributesExtractor.java b/instrumentation/jaxrs-client/jaxrs-client-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v1_1/JaxRsClientNetAttributesExtractor.java index eb80e0166a7f..5714f9541513 100644 --- a/instrumentation/jaxrs-client/jaxrs-client-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v1_1/JaxRsClientNetAttributesExtractor.java +++ b/instrumentation/jaxrs-client/jaxrs-client-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v1_1/JaxRsClientNetAttributesExtractor.java @@ -14,6 +14,10 @@ final class JaxRsClientNetAttributesExtractor extends NetAttributesExtractor { + JaxRsClientNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(ClientRequest request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v2_0/JaxRsClientNetAttributesExtractor.java b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v2_0/JaxRsClientNetAttributesExtractor.java index de96a7087640..02a3ac831a69 100644 --- a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v2_0/JaxRsClientNetAttributesExtractor.java +++ b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v2_0/JaxRsClientNetAttributesExtractor.java @@ -14,6 +14,10 @@ final class JaxRsClientNetAttributesExtractor extends NetAttributesExtractor { + JaxRsClientNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(ClientRequestContext request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v2_0/ResteasyClientNetAttributesExtractor.java b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v2_0/ResteasyClientNetAttributesExtractor.java index 62c9115968b8..46847a362a0f 100644 --- a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v2_0/ResteasyClientNetAttributesExtractor.java +++ b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v2_0/ResteasyClientNetAttributesExtractor.java @@ -14,6 +14,10 @@ final class ResteasyClientNetAttributesExtractor extends NetAttributesExtractor { + ResteasyClientNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(ClientInvocation request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/internal/JdbcNetAttributesExtractor.java b/instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/internal/JdbcNetAttributesExtractor.java index c0b9bd67525c..749e3e46c14c 100644 --- a/instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/internal/JdbcNetAttributesExtractor.java +++ b/instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/internal/JdbcNetAttributesExtractor.java @@ -10,6 +10,10 @@ public final class JdbcNetAttributesExtractor extends NetAttributesExtractor { + public JdbcNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Nullable @Override public String transport(DbRequest request) { diff --git a/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisNetAttributesExtractor.java b/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisNetAttributesExtractor.java index 0647d9dedc2c..c543e41e7cd9 100644 --- a/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisNetAttributesExtractor.java +++ b/instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisNetAttributesExtractor.java @@ -10,6 +10,10 @@ final class JedisNetAttributesExtractor extends NetAttributesExtractor { + JedisNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override @Nullable public String transport(JedisRequest request) { diff --git a/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisNetAttributesExtractor.java b/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisNetAttributesExtractor.java index 5927492ad0d7..fee92c63e99b 100644 --- a/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisNetAttributesExtractor.java +++ b/instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisNetAttributesExtractor.java @@ -14,6 +14,10 @@ final class JedisNetAttributesExtractor extends InetSocketAddressNetAttributesExtractor { + JedisNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public @Nullable InetSocketAddress getAddress(JedisRequest jedisRequest, @Nullable Void unused) { Socket socket = jedisRequest.getConnection().getSocket(); diff --git a/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/internal/JettyHttpClientNetAttributesExtractor.java b/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/internal/JettyHttpClientNetAttributesExtractor.java index 1cddd2826b95..39d900ff2e4b 100644 --- a/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/internal/JettyHttpClientNetAttributesExtractor.java +++ b/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/internal/JettyHttpClientNetAttributesExtractor.java @@ -14,6 +14,10 @@ public class JettyHttpClientNetAttributesExtractor extends NetAttributesExtractor { + public JettyHttpClientNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(Request request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesNetAttributesExtractor.java b/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesNetAttributesExtractor.java index 185700820451..002d9b9c4849 100644 --- a/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesNetAttributesExtractor.java +++ b/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesNetAttributesExtractor.java @@ -12,6 +12,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; class KubernetesNetAttributesExtractor extends NetAttributesExtractor> { + KubernetesNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(Request request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceConnectNetAttributesExtractor.java b/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceConnectNetAttributesExtractor.java index d5731f9d5067..938ccd143703 100644 --- a/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceConnectNetAttributesExtractor.java +++ b/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceConnectNetAttributesExtractor.java @@ -11,6 +11,10 @@ final class LettuceConnectNetAttributesExtractor extends NetAttributesExtractor { + LettuceConnectNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override @Nullable public String transport(RedisURI redisUri) { diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceConnectNetAttributesExtractor.java b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceConnectNetAttributesExtractor.java index 6dcbbb3f359b..594ae2053744 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceConnectNetAttributesExtractor.java +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceConnectNetAttributesExtractor.java @@ -11,6 +11,10 @@ final class LettuceConnectNetAttributesExtractor extends NetAttributesExtractor { + LettuceConnectNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override @Nullable public String transport(RedisURI redisUri) { diff --git a/instrumentation/liberty/liberty-dispatcher/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherLinkInstrumentation.java b/instrumentation/liberty/liberty-dispatcher/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherLinkInstrumentation.java index acf7d195372c..abdea866ec43 100644 --- a/instrumentation/liberty/liberty-dispatcher/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherLinkInstrumentation.java +++ b/instrumentation/liberty/liberty-dispatcher/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherLinkInstrumentation.java @@ -80,7 +80,6 @@ public static void stopSpan( scope.close(); LibertyResponse response = new LibertyResponse(statusCode); - request.setCompleted(); Throwable t = failure != null ? failure : throwable; instrumenter().end(context, request, response, t); diff --git a/instrumentation/liberty/liberty-dispatcher/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherNetAttributesExtractor.java b/instrumentation/liberty/liberty-dispatcher/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherNetAttributesExtractor.java index a92444eabe39..2d8a5b050ff5 100644 --- a/instrumentation/liberty/liberty-dispatcher/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherNetAttributesExtractor.java +++ b/instrumentation/liberty/liberty-dispatcher/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherNetAttributesExtractor.java @@ -12,6 +12,10 @@ public class LibertyDispatcherNetAttributesExtractor extends NetAttributesExtractor { + public LibertyDispatcherNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(LibertyRequest libertyRequest) { return SemanticAttributes.NetTransportValues.IP_TCP; @@ -20,30 +24,18 @@ public String transport(LibertyRequest libertyRequest) { @Override public @Nullable String peerName( LibertyRequest libertyRequest, @Nullable LibertyResponse libertyResponse) { - // condition limits calling peerName to onStart because in onEnd it may throw a NPE - if (!libertyRequest.isCompleted()) { - return libertyRequest.peerName(); - } - return null; + return libertyRequest.peerName(); } @Override public @Nullable Integer peerPort( LibertyRequest libertyRequest, @Nullable LibertyResponse libertyResponse) { - // condition limits calling getServerPort to onStart because in onEnd it may throw a NPE - if (!libertyRequest.isCompleted()) { - return libertyRequest.getServerPort(); - } - return null; + return libertyRequest.getServerPort(); } @Override public @Nullable String peerIp( LibertyRequest libertyRequest, @Nullable LibertyResponse libertyResponse) { - // condition limits calling peerIp to onStart because in onEnd it may throw a NPE - if (!libertyRequest.isCompleted()) { - return libertyRequest.peerIp(); - } - return null; + return libertyRequest.peerIp(); } } diff --git a/instrumentation/liberty/liberty-dispatcher/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyRequest.java b/instrumentation/liberty/liberty-dispatcher/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyRequest.java index 549173c7b4e6..b8ffed84ffa0 100644 --- a/instrumentation/liberty/liberty-dispatcher/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyRequest.java +++ b/instrumentation/liberty/liberty-dispatcher/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyRequest.java @@ -13,7 +13,6 @@ public class LibertyRequest { private final HttpDispatcherLink httpDispatcherLink; private final HttpRequestMessage httpRequestMessage; - private boolean completed; public LibertyRequest( HttpDispatcherLink httpDispatcherLink, HttpRequestMessage httpRequestMessage) { @@ -69,12 +68,4 @@ public String peerName() { public String getProtocol() { return httpRequestMessage.getVersion(); } - - public boolean isCompleted() { - return completed; - } - - public void setCompleted() { - completed = true; - } } diff --git a/instrumentation/okhttp/okhttp-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/okhttp/v2_2/OkHttp2NetAttributesExtractor.java b/instrumentation/okhttp/okhttp-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/okhttp/v2_2/OkHttp2NetAttributesExtractor.java index 311629264205..033b48958322 100644 --- a/instrumentation/okhttp/okhttp-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/okhttp/v2_2/OkHttp2NetAttributesExtractor.java +++ b/instrumentation/okhttp/okhttp-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/okhttp/v2_2/OkHttp2NetAttributesExtractor.java @@ -12,6 +12,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; public final class OkHttp2NetAttributesExtractor extends NetAttributesExtractor { + public OkHttp2NetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(Request request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/internal/OkHttpNetAttributesExtractor.java b/instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/internal/OkHttpNetAttributesExtractor.java index 929ac8d79213..a5cf410707b7 100644 --- a/instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/internal/OkHttpNetAttributesExtractor.java +++ b/instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/internal/OkHttpNetAttributesExtractor.java @@ -12,6 +12,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; public final class OkHttpNetAttributesExtractor extends NetAttributesExtractor { + public OkHttpNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(Request request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientNetAttributesExtractor.java b/instrumentation/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientNetAttributesExtractor.java index 6c50ae237ced..01f445107970 100644 --- a/instrumentation/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientNetAttributesExtractor.java +++ b/instrumentation/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientNetAttributesExtractor.java @@ -15,6 +15,10 @@ final class PlayWsClientNetAttributesExtractor extends InetSocketAddressNetAttributesExtractor { + PlayWsClientNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_END); + } + @Override public String transport(Request request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/ratpack-1.4/library/src/main/java/io/opentelemetry/instrumentation/ratpack/internal/RatpackNetAttributesExtractor.java b/instrumentation/ratpack-1.4/library/src/main/java/io/opentelemetry/instrumentation/ratpack/internal/RatpackNetAttributesExtractor.java index f43f19e01124..23618a6e658c 100644 --- a/instrumentation/ratpack-1.4/library/src/main/java/io/opentelemetry/instrumentation/ratpack/internal/RatpackNetAttributesExtractor.java +++ b/instrumentation/ratpack-1.4/library/src/main/java/io/opentelemetry/instrumentation/ratpack/internal/RatpackNetAttributesExtractor.java @@ -12,6 +12,10 @@ import ratpack.http.Response; public final class RatpackNetAttributesExtractor extends NetAttributesExtractor { + public RatpackNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override @Nullable public String transport(Request request) { diff --git a/instrumentation/redisson-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/RedissonNetAttributesExtractor.java b/instrumentation/redisson-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/RedissonNetAttributesExtractor.java index 4faf9ade5fcc..934d9eb846fa 100644 --- a/instrumentation/redisson-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/RedissonNetAttributesExtractor.java +++ b/instrumentation/redisson-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/RedissonNetAttributesExtractor.java @@ -12,6 +12,10 @@ final class RedissonNetAttributesExtractor extends InetSocketAddressNetAttributesExtractor { + RedissonNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public InetSocketAddress getAddress(RedissonRequest request, @Nullable Void unused) { return request.getAddress(); diff --git a/instrumentation/restlet/restlet-1.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v1_0/RestletNetAttributesExtractor.java b/instrumentation/restlet/restlet-1.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v1_0/RestletNetAttributesExtractor.java index cc4a6f1ff277..53f73257a5ff 100644 --- a/instrumentation/restlet/restlet-1.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v1_0/RestletNetAttributesExtractor.java +++ b/instrumentation/restlet/restlet-1.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v1_0/RestletNetAttributesExtractor.java @@ -12,6 +12,10 @@ import org.restlet.data.Response; final class RestletNetAttributesExtractor extends NetAttributesExtractor { + RestletNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(Request request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletNetAttributesExtractor.java b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletNetAttributesExtractor.java index f5f03cf15b52..364474ce60d5 100644 --- a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletNetAttributesExtractor.java +++ b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletNetAttributesExtractor.java @@ -15,6 +15,7 @@ public class ServletNetAttributesExtractor private final ServletAccessor accessor; public ServletNetAttributesExtractor(ServletAccessor accessor) { + super(NetPeerAttributeExtraction.ON_START); this.accessor = accessor; } diff --git a/instrumentation/spring/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/SpringWebNetAttributesExtractor.java b/instrumentation/spring/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/SpringWebNetAttributesExtractor.java index 09141a106c18..8d0ff27188b6 100644 --- a/instrumentation/spring/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/SpringWebNetAttributesExtractor.java +++ b/instrumentation/spring/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/SpringWebNetAttributesExtractor.java @@ -13,6 +13,10 @@ final class SpringWebNetAttributesExtractor extends NetAttributesExtractor { + SpringWebNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(HttpRequest httpRequest) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/spring/spring-webmvc-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/SpringWebMvcNetAttributesExtractor.java b/instrumentation/spring/spring-webmvc-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/SpringWebMvcNetAttributesExtractor.java index 5cc7c8bf0ba0..8f0de9397ab5 100644 --- a/instrumentation/spring/spring-webmvc-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/SpringWebMvcNetAttributesExtractor.java +++ b/instrumentation/spring/spring-webmvc-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/SpringWebMvcNetAttributesExtractor.java @@ -13,6 +13,10 @@ final class SpringWebMvcNetAttributesExtractor extends NetAttributesExtractor { + SpringWebMvcNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public String transport(HttpServletRequest request) { return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatNetAttributesExtractor.java b/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatNetAttributesExtractor.java index 4552f2d58284..280ed8dece84 100644 --- a/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatNetAttributesExtractor.java +++ b/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatNetAttributesExtractor.java @@ -13,6 +13,10 @@ public class TomcatNetAttributesExtractor extends NetAttributesExtractor { + public TomcatNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public @Nullable String transport(Request request) { // return SemanticAttributes.NetTransportValues.IP_TCP; diff --git a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowNetAttributesExtractor.java b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowNetAttributesExtractor.java index 8fe86cec3fe4..3920346cbd10 100644 --- a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowNetAttributesExtractor.java +++ b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowNetAttributesExtractor.java @@ -14,6 +14,10 @@ public class UndertowNetAttributesExtractor extends InetSocketAddressNetAttributesExtractor { + protected UndertowNetAttributesExtractor() { + super(NetPeerAttributeExtraction.ON_START); + } + @Override public @Nullable InetSocketAddress getAddress( HttpServerExchange exchange, @Nullable HttpServerExchange unused) {