Move get attribute inside condition where used (#12604)

This commit is contained in:
Trask Stalnaker 2024-11-09 23:31:45 -08:00 committed by GitHub
parent 0e099b281b
commit 591cdf5c79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 7 deletions

View File

@ -33,18 +33,23 @@ public final class InternalNetworkAttributesExtractor<REQUEST, RESPONSE> {
}
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) {