1

I am using r2dbc pool and implemented r2dbcEntityTemplate for DB operation.

I want to analyze connection pool details print log after executing every query(how many connections used,time etc.) how can I achieve this.

I tried logging but didn't worked.

io.r2dbc.postgresql: TRACE
io.r2dbc.postgresql.client: TRACE
io.r2dbc.spi.ConnectionFactory: TRACE
@Bean
public ConnectionFactory connectionFactory() {
    PostgresqlConnectionConfiguration configuration =
        PostgresqlConnectionConfiguration.builder()
            .host(host)
            .port(port)
            .database(database)
            .schema(schema)
            .username(username)
            .password(password)
            .build();

    ConnectionFactory fg = new PostgresqlConnectionFactory(configuration);
    ConnectionPoolConfiguration connectionPoolConfiguration =
    ConnectionPoolConfiguration.builder(fg)
        .maxIdleTime(Duration.ofMillis(maxIdleTime)).acquireRetry(acquireRetry)
        .initialSize(initialSize).maxSize(maxSize).build();
    return new ConnectionPool(connectionPoolConfiguration);
}
EricSchaefer
  • 25,272
  • 21
  • 67
  • 103
Dev_IT
  • 11
  • 3

1 Answers1

1

Try adding the following to your application.yml file:

logging.level.io.r2dbc.pool: DEBUG

You will receive information like: Obtaining connection / Releasing connection.

At the moment they don't expose any statistics regarding the entire pool connections like Hikari.

Hacaw
  • 21
  • 2