diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/network/internal/InternalNetworkAttributesExtractor.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/network/internal/InternalNetworkAttributesExtractor.java index 7d0cb9eea012..3752c0252713 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/network/internal/InternalNetworkAttributesExtractor.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/network/internal/InternalNetworkAttributesExtractor.java @@ -33,18 +33,23 @@ public InternalNetworkAttributesExtractor( } public void onEnd(AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response) { - String protocolName = lowercase(getter.getNetworkProtocolName(request, response)); - String protocolVersion = lowercase(getter.getNetworkProtocolVersion(request, response)); - if (captureProtocolAttributes) { - String transport = lowercase(getter.getNetworkTransport(request, response)); - internalSet(attributes, NetworkAttributes.NETWORK_TRANSPORT, transport); + internalSet( + attributes, + NetworkAttributes.NETWORK_TRANSPORT, + lowercase(getter.getNetworkTransport(request, response))); internalSet( attributes, NetworkAttributes.NETWORK_TYPE, lowercase(getter.getNetworkType(request, response))); - internalSet(attributes, NetworkAttributes.NETWORK_PROTOCOL_NAME, protocolName); - internalSet(attributes, NetworkAttributes.NETWORK_PROTOCOL_VERSION, protocolVersion); + internalSet( + attributes, + NetworkAttributes.NETWORK_PROTOCOL_NAME, + lowercase(getter.getNetworkProtocolName(request, response))); + internalSet( + attributes, + NetworkAttributes.NETWORK_PROTOCOL_VERSION, + lowercase(getter.getNetworkProtocolVersion(request, response))); } if (captureLocalSocketAttributes) {