use of io.vertx.sqlclient.impl.tracing.QueryTracer in project vertx-sql-client by eclipse-vertx.
the class MSSQLDriver method newPoolImpl.
private PoolImpl newPoolImpl(VertxInternal vertx, List<? extends SqlConnectOptions> databases, PoolOptions options, CloseFuture closeFuture) {
MSSQLConnectOptions baseConnectOptions = MSSQLConnectOptions.wrap(databases.get(0));
QueryTracer tracer = vertx.tracer() == null ? null : new QueryTracer(vertx.tracer(), baseConnectOptions);
VertxMetrics vertxMetrics = vertx.metricsSPI();
ClientMetrics metrics = vertxMetrics != null ? vertxMetrics.createClientMetrics(baseConnectOptions.getSocketAddress(), "sql", baseConnectOptions.getMetricsName()) : null;
PoolImpl pool = new PoolImpl(vertx, this, tracer, metrics, 1, options, null, null, closeFuture);
List<ConnectionFactory> lst = databases.stream().map(o -> createConnectionFactory(vertx, o)).collect(Collectors.toList());
ConnectionFactory factory = ConnectionFactory.roundRobinSelector(lst);
pool.connectionProvider(factory::connect);
pool.init();
closeFuture.add(factory);
return pool;
}
use of io.vertx.sqlclient.impl.tracing.QueryTracer in project vertx-sql-client by eclipse-vertx.
the class OracleConnectionFactory method connect.
@Override
public Future<SqlConnection> connect(Context context) {
ContextInternal ctx = (ContextInternal) context;
QueryTracer tracer = ctx.tracer() == null ? null : new QueryTracer(ctx.tracer(), options);
return context.<OracleConnection>executeBlocking(prom -> {
try {
prom.complete(datasource.createConnectionBuilder().build());
} catch (SQLException e) {
prom.fail(e);
}
}).map(ora -> {
CommandHandler conn = new CommandHandler((ContextInternal) context, options, ora);
OracleConnectionImpl msConn = new OracleConnectionImpl(ctx, this, conn, tracer, null);
conn.init(msConn);
return msConn;
});
}
use of io.vertx.sqlclient.impl.tracing.QueryTracer in project vertx-sql-client by eclipse-vertx.
the class PgDriver method newPoolImpl.
private PoolImpl newPoolImpl(VertxInternal vertx, List<? extends SqlConnectOptions> databases, PoolOptions options, CloseFuture closeFuture) {
PgConnectOptions baseConnectOptions = PgConnectOptions.wrap(databases.get(0));
QueryTracer tracer = vertx.tracer() == null ? null : new QueryTracer(vertx.tracer(), baseConnectOptions);
VertxMetrics vertxMetrics = vertx.metricsSPI();
ClientMetrics metrics = vertxMetrics != null ? vertxMetrics.createClientMetrics(baseConnectOptions.getSocketAddress(), "sql", baseConnectOptions.getMetricsName()) : null;
boolean pipelinedPool = options instanceof PgPoolOptions && ((PgPoolOptions) options).isPipelined();
int pipeliningLimit = pipelinedPool ? baseConnectOptions.getPipeliningLimit() : 1;
PoolImpl pool = new PoolImpl(vertx, this, tracer, metrics, pipeliningLimit, options, null, null, closeFuture);
List<ConnectionFactory> lst = databases.stream().map(o -> createConnectionFactory(vertx, o)).collect(Collectors.toList());
ConnectionFactory factory = ConnectionFactory.roundRobinSelector(lst);
pool.connectionProvider(factory::connect);
pool.init();
closeFuture.add(factory);
return pool;
}
use of io.vertx.sqlclient.impl.tracing.QueryTracer in project vertx-sql-client by eclipse-vertx.
the class DB2ConnectionFactory method connect.
@Override
public Future<SqlConnection> connect(Context context) {
ContextInternal contextInternal = (ContextInternal) context;
QueryTracer tracer = contextInternal.tracer() == null ? null : new QueryTracer(contextInternal.tracer(), options);
Promise<SqlConnection> promise = contextInternal.promise();
connect(asEventLoopContext(contextInternal)).map(conn -> {
DB2ConnectionImpl db2Connection = new DB2ConnectionImpl(contextInternal, this, conn, tracer, null);
conn.init(db2Connection);
return (SqlConnection) db2Connection;
}).onComplete(promise);
return promise.future();
}
use of io.vertx.sqlclient.impl.tracing.QueryTracer in project vertx-sql-client by eclipse-vertx.
the class OracleDriver method newPoolImpl.
private PoolImpl newPoolImpl(VertxInternal vertx, List<? extends SqlConnectOptions> databases, PoolOptions options, CloseFuture closeFuture) {
OracleConnectOptions baseConnectOptions = OracleConnectOptions.wrap(databases.get(0));
QueryTracer tracer = vertx.tracer() == null ? null : new QueryTracer(vertx.tracer(), baseConnectOptions);
VertxMetrics vertxMetrics = vertx.metricsSPI();
ClientMetrics metrics = vertxMetrics != null ? vertxMetrics.createClientMetrics(baseConnectOptions.getSocketAddress(), "sql", baseConnectOptions.getMetricsName()) : null;
Function<Connection, Future<Void>> afterAcquire = conn -> ((CommandHandler) conn).afterAcquire();
Function<Connection, Future<Void>> beforeRecycle = conn -> ((CommandHandler) conn).beforeRecycle();
PoolImpl pool = new PoolImpl(vertx, this, tracer, metrics, 1, options, afterAcquire, beforeRecycle, closeFuture);
List<ConnectionFactory> lst = databases.stream().map(o -> createConnectionFactory(vertx, o)).collect(Collectors.toList());
ConnectionFactory factory = ConnectionFactory.roundRobinSelector(lst);
pool.connectionProvider(factory::connect);
pool.init();
closeFuture.add(factory);
return pool;
}
Aggregations