Add comment and consistency.
MODIFY
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/decorator/HttpClientDecorator.java
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/decorator/HttpClientDecorator.java
@@ -68,6 +68,7 @@ public abstract class HttpClientDecorator<REQUEST, RESPONSE> extends ClientDecor
Tags.PEER_HOSTNAME.set(span, hostname(request));
final Integer port = port(request);
+ // Negative or Zero ports might represent an unset/null value for an int type. Skip setting.
Tags.PEER_PORT.set(span, port != null && port > 0 ? port : null);
if (Config.get().isHttpClientSplitByDomain()) {

MODIFY
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/decorator/HttpServerDecorator.java
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/decorator/HttpServerDecorator.java
@@ -88,7 +88,9 @@ public abstract class HttpServerDecorator<REQUEST, CONNECTION, RESPONSE> extends
Tags.PEER_HOST_IPV6.set(span, ip);
}
}
- Tags.PEER_PORT.set(span, peerPort(connection));
+ final Integer port = peerPort(connection);
+ // Negative or Zero ports might represent an unset/null value for an int type. Skip setting.
+ Tags.PEER_PORT.set(span, port != null && port > 0 ? port : null);
}
return span;
}

Add comment and consistency.