Skip to content

Commit

Permalink
enable TcpClient metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
rxdcxdrnine committed Jan 18, 2025
1 parent 9d9e763 commit f113046
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.publisher.SynchronousSink;
import reactor.netty.internal.util.Metrics;
import reactor.netty.resources.LoopResources;
import reactor.netty.tcp.TcpClient;

Expand Down Expand Up @@ -155,6 +156,10 @@ static Mono<Client> connect(MySqlSslConfiguration ssl, SocketAddress address, bo
tcpClient = tcpClient.resolver(resolver);
}

if (Metrics.isMicrometerAvailable()) {
tcpClient.metrics(true);
}

return tcpClient.remoteAddress(() -> address).connect()
.map(conn -> new ReactorNettyClient(conn, ssl, context));
}
Expand Down

0 comments on commit f113046

Please sign in to comment.