示例#1
0
        public IConnectionPoolListener CreateConnectionPoolListener(Uri poolUri, IConnectionPool pool)
        {
            var acquisitionTimeout = _config.ConnectionAcquisitionTimeout;
            var poolMetrics        = new ConnectionPoolMetrics(poolUri, pool, acquisitionTimeout);
            var key = poolMetrics.UniqueName;

            return((IConnectionPoolListener)_poolMetrics.GetOrAdd(key, poolMetrics));
        }
示例#2
0
        public ConnectionPoolMetrics AddPoolMetrics(Uri poolUri, IConnectionPool pool)
        {
            var acquisitionTimeout = _config.ConnectionAcquisitionTimeout;
            var poolMetrics        = new ConnectionPoolMetrics(poolUri, pool, acquisitionTimeout);
            var key = poolMetrics.UniqueName;

            _poolMetrics.AddOrUpdate(key, poolMetrics, (oldKey, oldValue) => poolMetrics);
            return(poolMetrics);
        }
示例#3
0
        public DriverMetricsManager(Metrics metrics, Uri poolUri, ConnectionPool pool)
        {
            Throw.ArgumentNullException.IfNull(metrics, nameof(metrics));
            Throw.ArgumentNullException.IfNull(metrics.ConnectionMetrics, nameof(metrics.ConnectionMetrics));
            Throw.ArgumentNullException.IfNull(metrics.ConnectionPoolMetrics, nameof(metrics.ConnectionPoolMetrics));
            Throw.ArgumentNullException.IfNull(poolUri, nameof(poolUri));
            Throw.ArgumentNullException.IfNull(pool, nameof(pool));

            _poolMetrics = metrics.AddPoolMetrics(poolUri, pool);
            _connMetrics = metrics.AddConnMetrics(poolUri);
        }
        public IConnectionPoolListener PutPoolMetrics(string poolId, IConnectionPool pool)
        {
            var poolMetrics = new ConnectionPoolMetrics(poolId, pool, this);

            return(_poolMetrics.GetOrAdd(poolId, poolMetrics));
        }