use of io.vertx.sqlclient.impl.tracing.QueryTracer in project vertx-sql-client by eclipse-vertx.
the class MySQLDriver method newPoolImpl.
private PoolImpl newPoolImpl(VertxInternal vertx, List<? extends SqlConnectOptions> databases, PoolOptions options, CloseFuture closeFuture) {
MySQLConnectOptions baseConnectOptions = MySQLConnectOptions.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 MySQLConnectionFactory 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 -> {
MySQLConnectionImpl mySQLConnection = new MySQLConnectionImpl(contextInternal, this, conn, tracer, null);
conn.init(mySQLConnection);
return (SqlConnection) mySQLConnection;
}).onComplete(promise);
return promise.future();
}
use of io.vertx.sqlclient.impl.tracing.QueryTracer in project vertx-sql-client by eclipse-vertx.
the class DB2Driver method newPoolImpl.
private PoolImpl newPoolImpl(VertxInternal vertx, List<? extends SqlConnectOptions> databases, PoolOptions options, CloseFuture closeFuture) {
DB2ConnectOptions baseConnectOptions = DB2ConnectOptions.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 Db2PoolOptions && ((Db2PoolOptions) 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 MSSQLConnectionFactory method connect.
@Override
public Future<SqlConnection> connect(Context context) {
ContextInternal ctx = (ContextInternal) context;
QueryTracer tracer = ctx.tracer() == null ? null : new QueryTracer(ctx.tracer(), options);
Promise<SqlConnection> promise = ctx.promise();
connect(asEventLoopContext(ctx)).map(conn -> {
MSSQLConnectionImpl msConn = new MSSQLConnectionImpl(ctx, this, conn, tracer, null);
conn.init(msConn);
return (SqlConnection) msConn;
}).onComplete(promise);
return promise.future();
}
use of io.vertx.sqlclient.impl.tracing.QueryTracer in project vertx-sql-client by eclipse-vertx.
the class PgConnectionFactory method connect.
@Override
public Future<SqlConnection> connect(Context context) {
ContextInternal contextInternal = (ContextInternal) context;
PromiseInternal<SqlConnection> promise = contextInternal.promise();
connect(asEventLoopContext(contextInternal)).map(conn -> {
QueryTracer tracer = contextInternal.tracer() == null ? null : new QueryTracer(contextInternal.tracer(), options);
PgConnectionImpl pgConn = new PgConnectionImpl(this, contextInternal, conn, tracer, null);
conn.init(pgConn);
return (SqlConnection) pgConn;
}).onComplete(promise);
return promise.future();
}
Aggregations