Disable peer hostname tag for http servers
Getting peer hostname makes DNS request
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
@@ -23,8 +23,6 @@ public abstract class HttpServerDecorator<REQUEST, CONNECTION, RESPONSE> extends
protected abstract URI url(REQUEST request) throws URISyntaxException;
- protected abstract String peerHostname(CONNECTION connection);
-
protected abstract String peerHostIP(CONNECTION connection);
protected abstract Integer peerPort(CONNECTION connection);
@@ -87,7 +85,6 @@ public abstract class HttpServerDecorator<REQUEST, CONNECTION, RESPONSE> extends
public AgentSpan onConnection(final AgentSpan span, final CONNECTION connection) {
assert span != null;
if (connection != null) {
- span.setTag(Tags.PEER_HOSTNAME.getKey(), peerHostname(connection));
final String ip = peerHostIP(connection);
if (ip != null) {
if (VALID_IPV4_ADDRESS.matcher(ip).matches()) {

MODIFY
dd-java-agent/agent-tooling/src/test/groovy/datadog/trace/agent/decorator/HttpServerDecoratorTest.groovy
dd-java-agent/agent-tooling/src/test/groovy/datadog/trace/agent/decorator/HttpServerDecoratorTest.groovy
@@ -83,7 +83,6 @@ class HttpServerDecoratorTest extends ServerDecoratorTest {
then:
if (conn) {
- 1 * span.setTag(Tags.PEER_HOSTNAME.key, "test-host")
1 * span.setTag(Tags.PEER_PORT.key, 555)
if (ipv4) {
1 * span.setTag(Tags.PEER_HOST_IPV4.key, "10.0.0.1")
@@ -96,9 +95,9 @@ class HttpServerDecoratorTest extends ServerDecoratorTest {
where:
ipv4 | conn
null | null
- null | [host: "test-host", ip: null, port: 555]
- true | [host: "test-host", ip: "10.0.0.1", port: 555]
- false | [host: "test-host", ip: "3ffe:1900:4545:3:200:f8ff:fe21:67cf", port: 555]
+ null | [ip: null, port: 555]
+ true | [ip: "10.0.0.1", port: 555]
+ false | [ip: "3ffe:1900:4545:3:200:f8ff:fe21:67cf", port: 555]
}
def "test onResponse"() {
@@ -173,11 +172,6 @@ class HttpServerDecoratorTest extends ServerDecoratorTest {
return m.url
}
- @Override
- protected String peerHostname(Map m) {
- return m.host
- }
-
@Override
protected String peerHostIP(Map m) {
return m.ip

MODIFY
dd-java-agent/instrumentation/akka-http-10.0/src/main/java/datadog/trace/instrumentation/akkahttp/AkkaHttpServerDecorator.java
dd-java-agent/instrumentation/akka-http-10.0/src/main/java/datadog/trace/instrumentation/akkahttp/AkkaHttpServerDecorator.java
@@ -30,11 +30,6 @@ public class AkkaHttpServerDecorator
return new URI(httpRequest.uri().toString());
}
- @Override
- protected String peerHostname(final HttpRequest httpRequest) {
- return null;
- }
-
@Override
protected String peerHostIP(final HttpRequest httpRequest) {
return null;

MODIFY
dd-java-agent/instrumentation/finatra-2.9/src/main/java/datadog/trace/instrumentation/finatra/FinatraDecorator.java
dd-java-agent/instrumentation/finatra-2.9/src/main/java/datadog/trace/instrumentation/finatra/FinatraDecorator.java
@@ -24,11 +24,6 @@ public class FinatraDecorator extends HttpServerDecorator<Request, Request, Resp
return URI.create(request.uri());
}
- @Override
- protected String peerHostname(final Request request) {
- return request.remoteHost();
- }
-
@Override
protected String peerHostIP(final Request request) {
return request.remoteAddress().getHostAddress();

MODIFY
dd-java-agent/instrumentation/grizzly-2/src/main/java/datadog/trace/instrumentation/grizzly/GrizzlyDecorator.java
dd-java-agent/instrumentation/grizzly-2/src/main/java/datadog/trace/instrumentation/grizzly/GrizzlyDecorator.java
@@ -26,11 +26,6 @@ public class GrizzlyDecorator extends HttpServerDecorator<Request, Request, Resp
null);
}
- @Override
- protected String peerHostname(final Request request) {
- return request.getRemoteHost();
- }
-
@Override
protected String peerHostIP(final Request request) {
return request.getRemoteAddr();

MODIFY
dd-java-agent/instrumentation/jetty-8/src/main/java/datadog/trace/instrumentation/jetty8/JettyDecorator.java
dd-java-agent/instrumentation/jetty-8/src/main/java/datadog/trace/instrumentation/jetty8/JettyDecorator.java
@@ -38,11 +38,6 @@ public class JettyDecorator
null);
}
- @Override
- protected String peerHostname(final HttpServletRequest httpServletRequest) {
- return httpServletRequest.getRemoteHost();
- }
-
@Override
protected String peerHostIP(final HttpServletRequest httpServletRequest) {
return httpServletRequest.getRemoteAddr();

MODIFY
dd-java-agent/instrumentation/netty-4.0/src/main/java/datadog/trace/instrumentation/netty40/server/NettyHttpServerDecorator.java
dd-java-agent/instrumentation/netty-4.0/src/main/java/datadog/trace/instrumentation/netty40/server/NettyHttpServerDecorator.java
@@ -42,15 +42,6 @@ public class NettyHttpServerDecorator
}
}
- @Override
- protected String peerHostname(final Channel channel) {
- final SocketAddress socketAddress = channel.remoteAddress();
- if (socketAddress instanceof InetSocketAddress) {
- return ((InetSocketAddress) socketAddress).getHostName();
- }
- return null;
- }
-
@Override
protected String peerHostIP(final Channel channel) {
final SocketAddress socketAddress = channel.remoteAddress();

MODIFY
dd-java-agent/instrumentation/netty-4.1/src/main/java/datadog/trace/instrumentation/netty41/server/NettyHttpServerDecorator.java
dd-java-agent/instrumentation/netty-4.1/src/main/java/datadog/trace/instrumentation/netty41/server/NettyHttpServerDecorator.java
@@ -42,15 +42,6 @@ public class NettyHttpServerDecorator
}
}
- @Override
- protected String peerHostname(final Channel channel) {
- final SocketAddress socketAddress = channel.remoteAddress();
- if (socketAddress instanceof InetSocketAddress) {
- return ((InetSocketAddress) socketAddress).getHostName();
- }
- return null;
- }
-
@Override
protected String peerHostIP(final Channel channel) {
final SocketAddress socketAddress = channel.remoteAddress();

MODIFY
dd-java-agent/instrumentation/play-2.4/src/main/java8/datadog/trace/instrumentation/play24/PlayHttpServerDecorator.java
dd-java-agent/instrumentation/play-2.4/src/main/java8/datadog/trace/instrumentation/play24/PlayHttpServerDecorator.java
@@ -37,11 +37,6 @@ public class PlayHttpServerDecorator extends HttpServerDecorator<Request, Reques
return new URI((request.secure() ? "https://" : "http://") + request.host() + request.uri());
}
- @Override
- protected String peerHostname(final Request request) {
- return null;
- }
-
@Override
protected String peerHostIP(final Request request) {
return request.remoteAddress();

MODIFY
dd-java-agent/instrumentation/play-2.6/src/main/java8/datadog/trace/instrumentation/play26/PlayHttpServerDecorator.java
dd-java-agent/instrumentation/play-2.6/src/main/java8/datadog/trace/instrumentation/play26/PlayHttpServerDecorator.java
@@ -39,11 +39,6 @@ public class PlayHttpServerDecorator extends HttpServerDecorator<Request, Reques
return new URI((request.secure() ? "https://" : "http://") + request.host() + request.uri());
}
- @Override
- protected String peerHostname(final Request request) {
- return null;
- }
-
@Override
protected String peerHostIP(final Request request) {
return request.remoteAddress();

MODIFY
dd-java-agent/instrumentation/ratpack-1.4/src/main/java8/datadog/trace/instrumentation/ratpack/RatpackServerDecorator.java
dd-java-agent/instrumentation/ratpack-1.4/src/main/java8/datadog/trace/instrumentation/ratpack/RatpackServerDecorator.java
@@ -48,11 +48,6 @@ public class RatpackServerDecorator extends HttpServerDecorator<Request, Request
return url.build();
}
- @Override
- protected String peerHostname(final Request request) {
- return request.getRemoteAddress().getHostText();
- }
-
@Override
protected String peerHostIP(final Request request) {
return request.getRemoteAddress().getHostText();

MODIFY
dd-java-agent/instrumentation/servlet/request-2/src/main/java/datadog/trace/instrumentation/servlet2/Servlet2Decorator.java
dd-java-agent/instrumentation/servlet/request-2/src/main/java/datadog/trace/instrumentation/servlet2/Servlet2Decorator.java
@@ -38,11 +38,6 @@ public class Servlet2Decorator
null);
}
- @Override
- protected String peerHostname(final HttpServletRequest httpServletRequest) {
- return httpServletRequest.getRemoteHost();
- }
-
@Override
protected String peerHostIP(final HttpServletRequest httpServletRequest) {
return httpServletRequest.getRemoteAddr();

MODIFY
dd-java-agent/instrumentation/servlet/request-3/src/main/java/datadog/trace/instrumentation/servlet3/Servlet3Decorator.java
dd-java-agent/instrumentation/servlet/request-3/src/main/java/datadog/trace/instrumentation/servlet3/Servlet3Decorator.java
@@ -39,11 +39,6 @@ public class Servlet3Decorator
null);
}
- @Override
- protected String peerHostname(final HttpServletRequest httpServletRequest) {
- return httpServletRequest.getRemoteHost();
- }
-
@Override
protected String peerHostIP(final HttpServletRequest httpServletRequest) {
return httpServletRequest.getRemoteAddr();

MODIFY
dd-java-agent/instrumentation/spring-webmvc-3.1/src/main/java/datadog/trace/instrumentation/springweb/SpringWebHttpServerDecorator.java
dd-java-agent/instrumentation/spring-webmvc-3.1/src/main/java/datadog/trace/instrumentation/springweb/SpringWebHttpServerDecorator.java
@@ -60,11 +60,6 @@ public class SpringWebHttpServerDecorator
null);
}
- @Override
- protected String peerHostname(final HttpServletRequest httpServletRequest) {
- return httpServletRequest.getRemoteHost();
- }
-
@Override
protected String peerHostIP(final HttpServletRequest httpServletRequest) {
return httpServletRequest.getRemoteAddr();

Disable peer hostname tag for http servers

Getting peer hostname makes DNS request