diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBuilder.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBuilder.java index 502f4b5612c3..3e5bdde89b59 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBuilder.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBuilder.java @@ -135,9 +135,9 @@ InternalNetClientAttributesExtractor buildNetExtractor() { InternalNetworkAttributesExtractor buildNetworkExtractor() { return new InternalNetworkAttributesExtractor<>( netAttributesGetter, - HttpNetworkTransportFilter.INSTANCE, AddressAndPortExtractor.noop(), serverAddressAndPortExtractor, + /* captureNetworkTransportAndType= */ false, /* captureLocalSocketAttributes= */ false, /* captureOldPeerDomainAttribute= */ true, SemconvStability.emitStableHttpSemconv(), diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpNetworkTransportFilter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpNetworkTransportFilter.java deleted file mode 100644 index 8df6989fcdde..000000000000 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpNetworkTransportFilter.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.instrumentation.api.instrumenter.http; - -import io.opentelemetry.instrumentation.api.instrumenter.network.internal.NetworkTransportFilter; -import javax.annotation.Nullable; - -enum HttpNetworkTransportFilter implements NetworkTransportFilter { - INSTANCE; - - @Override - public boolean shouldAddNetworkTransport( - @Nullable String protocolName, - @Nullable String protocolVersion, - @Nullable String proposedTransport) { - // tcp is the default transport for http/1* and http/2*, we're skipping it - if ("http".equals(protocolName) - && protocolVersion != null - && (protocolVersion.startsWith("1") || protocolVersion.startsWith("2")) - && "tcp".equals(proposedTransport)) { - return false; - } - // udp is the default transport for http/3*, we're skipping it - if ("http".equals(protocolName) - && protocolVersion != null - && protocolVersion.startsWith("3") - && "udp".equals(proposedTransport)) { - return false; - } - return true; - } -} diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorBuilder.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorBuilder.java index e61f583dc4c5..224d51c4601f 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorBuilder.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorBuilder.java @@ -151,9 +151,9 @@ InternalNetServerAttributesExtractor buildNetExtractor() { InternalNetworkAttributesExtractor buildNetworkExtractor() { return new InternalNetworkAttributesExtractor<>( netAttributesGetter, - HttpNetworkTransportFilter.INSTANCE, serverAddressPortExtractor, clientAddressPortExtractor, + /* captureNetworkTransportAndType= */ false, /* captureLocalSocketAttributes= */ false, /* captureOldPeerDomainAttribute= */ false, SemconvStability.emitStableHttpSemconv(), diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractor.java index e74291670d65..5e9458ece162 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractor.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractor.java @@ -12,7 +12,6 @@ import io.opentelemetry.instrumentation.api.instrumenter.network.internal.AddressAndPortExtractor; import io.opentelemetry.instrumentation.api.instrumenter.network.internal.InternalNetworkAttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.network.internal.InternalServerAttributesExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.network.internal.NetworkTransportFilter; import io.opentelemetry.instrumentation.api.instrumenter.network.internal.ServerAddressAndPortExtractor; import io.opentelemetry.instrumentation.api.internal.SemconvStability; import javax.annotation.Nullable; @@ -51,9 +50,9 @@ private NetClientAttributesExtractor(NetClientAttributesGetter( getter, - NetworkTransportFilter.alwaysTrue(), AddressAndPortExtractor.noop(), serverAddressAndPortExtractor, + /* captureNetworkTransportAndType= */ true, /* captureLocalSocketAttributes= */ false, /* captureOldPeerDomainAttribute= */ true, SemconvStability.emitStableHttpSemconv(), diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractor.java index b819c4a2997a..67493be7ed77 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractor.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesExtractor.java @@ -14,7 +14,6 @@ import io.opentelemetry.instrumentation.api.instrumenter.network.internal.InternalClientAttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.network.internal.InternalNetworkAttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.network.internal.InternalServerAttributesExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.network.internal.NetworkTransportFilter; import io.opentelemetry.instrumentation.api.instrumenter.network.internal.ServerAddressAndPortExtractor; import io.opentelemetry.instrumentation.api.internal.SemconvStability; import javax.annotation.Nullable; @@ -53,9 +52,9 @@ private NetServerAttributesExtractor(NetServerAttributesGetter( getter, - NetworkTransportFilter.alwaysTrue(), serverAddressAndPortExtractor, clientAddressAndPortExtractor, + /* captureNetworkTransportAndType= */ true, /* captureLocalSocketAttributes= */ true, /* captureOldPeerDomainAttribute= */ false, SemconvStability.emitStableHttpSemconv(), diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/NetworkAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/NetworkAttributesExtractor.java index 825894041454..89ea385b8b34 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/NetworkAttributesExtractor.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/NetworkAttributesExtractor.java @@ -10,7 +10,6 @@ import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.network.internal.AddressAndPortExtractor; import io.opentelemetry.instrumentation.api.instrumenter.network.internal.InternalNetworkAttributesExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.network.internal.NetworkTransportFilter; import io.opentelemetry.instrumentation.api.internal.SemconvStability; import javax.annotation.Nullable; @@ -37,9 +36,9 @@ public static NetworkAttributesExtractor internalExtractor = new InternalNetworkAttributesExtractor<>( getter, - NetworkTransportFilter.alwaysTrue(), AddressAndPortExtractor.noop(), AddressAndPortExtractor.noop(), + /* captureNetworkTransportAndType= */ true, /* captureLocalSocketAttributes= */ true, // capture the old net.sock.peer.name attr for backwards compatibility /* captureOldPeerDomainAttribute= */ true, diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/internal/InternalNetworkAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/internal/InternalNetworkAttributesExtractor.java index 2f9eac0312dc..f2529cbe7a0d 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/internal/InternalNetworkAttributesExtractor.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/internal/InternalNetworkAttributesExtractor.java @@ -22,9 +22,9 @@ public final class InternalNetworkAttributesExtractor { private final NetworkAttributesGetter getter; - private final NetworkTransportFilter networkTransportFilter; private final AddressAndPortExtractor logicalLocalAddressAndPortExtractor; private final AddressAndPortExtractor logicalPeerAddressAndPortExtractor; + private final boolean captureNetworkTransportAndType; private final boolean captureLocalSocketAttributes; private final boolean captureOldPeerDomainAttribute; private final boolean emitStableUrlAttributes; @@ -32,17 +32,17 @@ public final class InternalNetworkAttributesExtractor { public InternalNetworkAttributesExtractor( NetworkAttributesGetter getter, - NetworkTransportFilter networkTransportFilter, AddressAndPortExtractor logicalLocalAddressAndPortExtractor, AddressAndPortExtractor logicalPeerAddressAndPortExtractor, + boolean captureNetworkTransportAndType, boolean captureLocalSocketAttributes, boolean captureOldPeerDomainAttribute, boolean emitStableUrlAttributes, boolean emitOldHttpAttributes) { this.getter = getter; - this.networkTransportFilter = networkTransportFilter; this.logicalLocalAddressAndPortExtractor = logicalLocalAddressAndPortExtractor; this.logicalPeerAddressAndPortExtractor = logicalPeerAddressAndPortExtractor; + this.captureNetworkTransportAndType = captureNetworkTransportAndType; this.captureLocalSocketAttributes = captureLocalSocketAttributes; this.captureOldPeerDomainAttribute = captureOldPeerDomainAttribute; this.emitStableUrlAttributes = emitStableUrlAttributes; @@ -56,14 +56,13 @@ public void onEnd(AttributesBuilder attributes, REQUEST request, @Nullable RESPO if (emitStableUrlAttributes) { String transport = lowercase(getter.getNetworkTransport(request, response)); - if (networkTransportFilter.shouldAddNetworkTransport( - protocolName, protocolVersion, transport)) { + if (captureNetworkTransportAndType) { internalSet(attributes, SemanticAttributes.NETWORK_TRANSPORT, transport); + internalSet( + attributes, + SemanticAttributes.NETWORK_TYPE, + lowercase(getter.getNetworkType(request, response))); } - internalSet( - attributes, - SemanticAttributes.NETWORK_TYPE, - lowercase(getter.getNetworkType(request, response))); internalSet(attributes, SemanticAttributes.NETWORK_PROTOCOL_NAME, protocolName); internalSet(attributes, SemanticAttributes.NETWORK_PROTOCOL_VERSION, protocolVersion); } diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/internal/NetworkTransportFilter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/internal/NetworkTransportFilter.java deleted file mode 100644 index 87b32c9dc1fa..000000000000 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/network/internal/NetworkTransportFilter.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.instrumentation.api.instrumenter.network.internal; - -import javax.annotation.Nullable; - -/** - * This class is internal and is hence not for public use. Its APIs are unstable and can change at - * any time. - */ -@FunctionalInterface -public interface NetworkTransportFilter { - - boolean shouldAddNetworkTransport( - @Nullable String protocolName, - @Nullable String protocolVersion, - @Nullable String proposedTransport); - - static NetworkTransportFilter alwaysTrue() { - return (protocolName, protocolVersion, proposedTransport) -> true; - } -} diff --git a/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBothSemconvTest.java b/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBothSemconvTest.java index de6918e12510..125dad78be7c 100644 --- a/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBothSemconvTest.java +++ b/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBothSemconvTest.java @@ -164,8 +164,6 @@ void normal() { asList("654", "321")), entry(SemanticAttributes.NET_PROTOCOL_NAME, "http"), entry(SemanticAttributes.NET_PROTOCOL_VERSION, "1.1"), - entry(SemanticAttributes.NETWORK_TRANSPORT, "udp"), - entry(SemanticAttributes.NETWORK_TYPE, "ipv4"), entry(SemanticAttributes.NETWORK_PROTOCOL_NAME, "http"), entry(SemanticAttributes.NETWORK_PROTOCOL_VERSION, "1.1")); } diff --git a/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorBothSemconvTest.java b/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorBothSemconvTest.java index b1cafe142951..e18aceaf4653 100644 --- a/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorBothSemconvTest.java +++ b/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorBothSemconvTest.java @@ -178,8 +178,6 @@ void normal() { .containsOnly( entry(SemanticAttributes.NET_PROTOCOL_NAME, "http"), entry(SemanticAttributes.NET_PROTOCOL_VERSION, "2.0"), - entry(SemanticAttributes.NETWORK_TRANSPORT, "udp"), - entry(SemanticAttributes.NETWORK_TYPE, "ipv4"), entry(SemanticAttributes.NETWORK_PROTOCOL_NAME, "http"), entry(SemanticAttributes.NETWORK_PROTOCOL_VERSION, "2.0"), entry(SemanticAttributes.HTTP_ROUTE, "/repositories/{repoId}"), diff --git a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorStableSemconvTest.java b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorStableSemconvTest.java index bf003138bdc7..d394d8374593 100644 --- a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorStableSemconvTest.java +++ b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorStableSemconvTest.java @@ -11,7 +11,6 @@ import static java.util.Collections.emptyMap; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.entry; -import static org.junit.jupiter.params.provider.Arguments.arguments; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; @@ -28,13 +27,9 @@ import java.util.List; import java.util.Map; import java.util.function.ToIntFunction; -import java.util.stream.Stream; import javax.annotation.Nullable; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.ArgumentsProvider; import org.junit.jupiter.params.provider.ArgumentsSource; import org.junit.jupiter.params.provider.ValueSource; @@ -194,57 +189,12 @@ void normal() { entry( AttributeKey.stringArrayKey("http.response.header.custom_response_header"), asList("654", "321")), - entry(SemanticAttributes.NETWORK_TRANSPORT, "udp"), - entry(SemanticAttributes.NETWORK_TYPE, "ipv4"), entry(SemanticAttributes.NETWORK_PROTOCOL_NAME, "http"), entry(SemanticAttributes.NETWORK_PROTOCOL_VERSION, "1.1"), entry(NetworkAttributes.NETWORK_PEER_ADDRESS, "4.3.2.1"), entry(NetworkAttributes.NETWORK_PEER_PORT, 456L)); } - @ParameterizedTest - @ArgumentsSource(NetworkTransportAndProtocolProvider.class) - void skipNetworkTransportIfDefaultForProtocol( - String observedProtocolName, - String observedProtocolVersion, - String observedTransport, - @Nullable String extractedTransport) { - Map request = new HashMap<>(); - request.put("networkProtocolName", observedProtocolName); - request.put("networkProtocolVersion", observedProtocolVersion); - request.put("networkTransport", observedTransport); - - AttributesExtractor, Map> extractor = - HttpClientAttributesExtractor.create(new TestHttpClientAttributesGetter()); - - AttributesBuilder attributes = Attributes.builder(); - extractor.onStart(attributes, Context.root(), request); - extractor.onEnd(attributes, Context.root(), request, emptyMap(), null); - - if (extractedTransport != null) { - assertThat(attributes.build()) - .containsEntry(SemanticAttributes.NETWORK_TRANSPORT, extractedTransport); - } else { - assertThat(attributes.build()).doesNotContainKey(SemanticAttributes.NETWORK_TRANSPORT); - } - } - - static final class NetworkTransportAndProtocolProvider implements ArgumentsProvider { - - @Override - public Stream provideArguments(ExtensionContext context) { - return Stream.of( - arguments("http", "1.0", "tcp", null), - arguments("http", "1.1", "tcp", null), - arguments("http", "2.0", "tcp", null), - arguments("http", "3.0", "udp", null), - arguments("http", "1.1", "udp", "udp"), - arguments("ftp", "2.0", "tcp", "tcp"), - arguments("http", "3.0", "tcp", "tcp"), - arguments("http", "42", "tcp", "tcp")); - } - } - @ParameterizedTest @ArgumentsSource(ValidRequestMethodsProvider.class) void shouldExtractKnownMethods(String requestMethod) { diff --git a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorStableSemconvTest.java b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorStableSemconvTest.java index e26dad0b9b74..cece15fa0a8b 100644 --- a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorStableSemconvTest.java +++ b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorStableSemconvTest.java @@ -11,7 +11,6 @@ import static java.util.Collections.emptyMap; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.entry; -import static org.junit.jupiter.params.provider.Arguments.arguments; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; @@ -28,13 +27,9 @@ import java.util.List; import java.util.Map; import java.util.function.Function; -import java.util.stream.Stream; import javax.annotation.Nullable; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.ArgumentsProvider; import org.junit.jupiter.params.provider.ArgumentsSource; import org.junit.jupiter.params.provider.ValueSource; @@ -231,8 +226,6 @@ void normal() { extractor.onEnd(endAttributes, Context.root(), request, response, null); assertThat(endAttributes.build()) .containsOnly( - entry(SemanticAttributes.NETWORK_TRANSPORT, "udp"), - entry(SemanticAttributes.NETWORK_TYPE, "ipv4"), entry(SemanticAttributes.NETWORK_PROTOCOL_NAME, "http"), entry(SemanticAttributes.NETWORK_PROTOCOL_VERSION, "2.0"), entry(NetworkAttributes.NETWORK_PEER_ADDRESS, "4.3.2.1"), @@ -246,49 +239,6 @@ void normal() { asList("654", "321"))); } - @ParameterizedTest - @ArgumentsSource(NetworkTransportAndProtocolProvider.class) - void skipNetworkTransportIfDefaultForProtocol( - String observedProtocolName, - String observedProtocolVersion, - String observedTransport, - @Nullable String extractedTransport) { - Map request = new HashMap<>(); - request.put("networkProtocolName", observedProtocolName); - request.put("networkProtocolVersion", observedProtocolVersion); - request.put("networkTransport", observedTransport); - - AttributesExtractor, Map> extractor = - HttpServerAttributesExtractor.create(new TestHttpServerAttributesGetter()); - - AttributesBuilder attributes = Attributes.builder(); - extractor.onStart(attributes, Context.root(), request); - extractor.onEnd(attributes, Context.root(), request, emptyMap(), null); - - if (extractedTransport != null) { - assertThat(attributes.build()) - .containsEntry(SemanticAttributes.NETWORK_TRANSPORT, extractedTransport); - } else { - assertThat(attributes.build()).doesNotContainKey(SemanticAttributes.NETWORK_TRANSPORT); - } - } - - static final class NetworkTransportAndProtocolProvider implements ArgumentsProvider { - - @Override - public Stream provideArguments(ExtensionContext context) { - return Stream.of( - arguments("http", "1.0", "tcp", null), - arguments("http", "1.1", "tcp", null), - arguments("http", "2.0", "tcp", null), - arguments("http", "3.0", "udp", null), - arguments("http", "1.1", "udp", "udp"), - arguments("ftp", "2.0", "tcp", "tcp"), - arguments("http", "3.0", "tcp", "tcp"), - arguments("http", "42", "tcp", "tcp")); - } - } - @ParameterizedTest @ArgumentsSource(ValidRequestMethodsProvider.class) void shouldExtractKnownMethods(String requestMethod) { 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 c1cf673d54db..9b0ddf792277 100644 --- a/instrumentation/undertow-1.4/javaagent/src/test/groovy/UndertowServerTest.groovy +++ b/instrumentation/undertow-1.4/javaagent/src/test/groovy/UndertowServerTest.groovy @@ -174,7 +174,6 @@ class UndertowServerTest extends HttpServerTest implements AgentTestTr "$SemanticAttributes.HTTP_RESPONSE_BODY_SIZE" Long "$SemanticAttributes.NETWORK_PROTOCOL_NAME" "http" "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" - "$SemanticAttributes.NETWORK_TYPE" "ipv4" "$SemanticAttributes.SERVER_ADDRESS" uri.host "$SemanticAttributes.SERVER_PORT" uri.port "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" @@ -247,7 +246,6 @@ class UndertowServerTest extends HttpServerTest implements AgentTestTr "$SemanticAttributes.HTTP_RESPONSE_BODY_SIZE" Long "$SemanticAttributes.NETWORK_PROTOCOL_NAME" "http" "$SemanticAttributes.NETWORK_PROTOCOL_VERSION" "1.1" - "$SemanticAttributes.NETWORK_TYPE" "ipv4" "$SemanticAttributes.SERVER_ADDRESS" uri.host "$SemanticAttributes.SERVER_PORT" uri.port "$NetworkAttributes.NETWORK_PEER_ADDRESS" "127.0.0.1" 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 82faa1bfe853..d5d14e6d8eb1 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 @@ -1002,13 +1002,11 @@ SpanDataAssert assertClientSpan( && attrs.get(SemanticAttributes.NET_TRANSPORT) != null) { assertThat(attrs).containsEntry(SemanticAttributes.NET_TRANSPORT, IP_TCP); } - if (SemconvStability.emitStableHttpSemconv() - && attrs.get(SemanticAttributes.NETWORK_TRANSPORT) != null) { - assertThat(attrs).containsEntry(SemanticAttributes.NETWORK_TRANSPORT, "tcp"); - } - if (SemconvStability.emitStableHttpSemconv() - && attrs.get(SemanticAttributes.NETWORK_TYPE) != null) { - assertThat(attrs).containsEntry(SemanticAttributes.NETWORK_TYPE, "ipv4"); + if (SemconvStability.emitStableHttpSemconv()) { + // we're opting out of these attributes in the new semconv + assertThat(attrs) + .doesNotContainKey(SemanticAttributes.NETWORK_TRANSPORT) + .doesNotContainKey(SemanticAttributes.NETWORK_TYPE); } AttributeKey netProtocolKey = getAttributeKey(SemanticAttributes.NET_PROTOCOL_NAME); 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 fe9ab4b12580..2aeea818b96b 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 @@ -742,13 +742,11 @@ protected SpanDataAssert assertServerSpan( && attrs.get(SemanticAttributes.NET_TRANSPORT) != null) { assertThat(attrs).containsEntry(SemanticAttributes.NET_TRANSPORT, IP_TCP); } - if (SemconvStability.emitStableHttpSemconv() - && attrs.get(SemanticAttributes.NETWORK_TRANSPORT) != null) { - assertThat(attrs).containsEntry(SemanticAttributes.NETWORK_TRANSPORT, "tcp"); - } - if (SemconvStability.emitStableHttpSemconv() - && attrs.get(SemanticAttributes.NETWORK_TYPE) != null) { - assertThat(attrs).containsEntry(SemanticAttributes.NETWORK_TYPE, "ipv4"); + if (SemconvStability.emitStableHttpSemconv()) { + // we're opting out of these attributes in the new semconv + assertThat(attrs) + .doesNotContainKey(SemanticAttributes.NETWORK_TRANSPORT) + .doesNotContainKey(SemanticAttributes.NETWORK_TYPE); } assertThat(attrs)