Avoid potential for reverse name lookup
MODIFY
instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitChannelNetAttributesGetter.java
instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitChannelNetAttributesGetter.java
@@ -20,7 +20,8 @@ public class RabbitChannelNetAttributesGetter
@Nullable
@Override
public String peerName(ChannelAndMethod channelAndMethod, @Nullable Void unused) {
- return channelAndMethod.getChannel().getConnection().getAddress().getHostName();
+ // not using InetAddress.getHostName() since that can trigger reverse name lookup
+ return null;
}
@Nullable

MODIFY
instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitReceiveNetAttributesGetter.java
instrumentation/rabbitmq-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rabbitmq/RabbitReceiveNetAttributesGetter.java
@@ -21,7 +21,8 @@ public class RabbitReceiveNetAttributesGetter
@Nullable
@Override
public String peerName(ReceiveRequest request, @Nullable GetResponse response) {
- return request.getConnection().getAddress().getHostName();
+ // not using InetAddress.getHostName() since that can trigger reverse name lookup
+ return null;
}
@Nullable

MODIFY
instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyHttpClientAttributesGetter.java
instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyHttpClientAttributesGetter.java
@@ -37,7 +37,7 @@ final class ReactorNettyHttpClientAttributesGetter
if (hostAddress instanceof InetSocketAddress) {
InetSocketAddress inetHostAddress = (InetSocketAddress) hostAddress;
return (request.isSecure() ? "https://" : "http://")
- + inetHostAddress.getHostName()
+ + inetHostAddress.getHostString()
+ ":"
+ inetHostAddress.getPort()
+ (uri.startsWith("/") ? "" : "/")

Avoid potential for reverse name lookup (#5305)