use of com.zaxxer.hikari.metrics.prometheus.PrometheusMetricsTrackerFactory in project curiostack by curioswitch.
the class DatabaseModule method dataSource.
@Provides
@Singleton
static DataSource dataSource(DatabaseConfig config) {
HikariConfig hikari = new HikariConfig();
hikari.setJdbcUrl(config.getJdbcUrl());
hikari.setUsername(config.getUsername());
hikari.setPassword(config.getPassword());
hikari.addDataSourceProperty("cachePrepStmts", true);
hikari.addDataSourceProperty("prepStmtCacheSize", 250);
hikari.addDataSourceProperty("prepStmtCacheSqlLimit", 2048);
hikari.addDataSourceProperty("useServerPrepStmts", true);
hikari.addDataSourceProperty("useLocalSessionState", true);
hikari.addDataSourceProperty("useLocalTransactionState", true);
hikari.addDataSourceProperty("rewriteBatchedStatements", true);
hikari.addDataSourceProperty("cacheResultSetMetadata", true);
hikari.addDataSourceProperty("cacheServerConfiguration", true);
hikari.addDataSourceProperty("elideSetAutoCommits", true);
hikari.addDataSourceProperty("maintainTimeStats", false);
hikari.addDataSourceProperty("statementInterceptors", "brave.mysql.TracingStatementInterceptor");
hikari.setMetricsTrackerFactory(new PrometheusMetricsTrackerFactory());
return new HikariDataSource(hikari);
}
Aggregations