How can we fetch tcp connect time or DNS resolution time for every request with Netty's TCPClient?
We are requesting 1000 tcp connections(unique hosts) per second. For every host we want to get the tcp connect time from client to host and use it for further processing. Netty's TCPClient also has metric support but for every request how can we get the same?
TcpClient.create()
.host(host)
.port(port).runOn(this.loopResources, true)
.metrics(true)
.resolver(spec -> {
spec.queryTimeout(Duration.ofMillis(1000));
spec.maxQueriesPerResolve(1);
spec.cacheMaxTimeToLive(Duration.ofMinutes(8));
spec.cacheMinTimeToLive(Duration.ofMinutes(5));
})
.doOnConnect(com -> {})
.doOnConnected(con -> {
con.dispose();
}).option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000)
.option(ChannelOption.SO_KEEPALIVE,false)
.option(ChannelOption.TCP_NODELAY,true)
.option(ChannelOption.SO_REUSEADDR,true)
.option(ChannelOption.AUTO_READ,false)
.connect().onErrorResume(throwable -> {
String result = "Error-->" + throwable.getMessage();
return Mono.empty();
}).retry(1);