/** * Captures the connection pool metrics. */ private void captureConnectionPoolMetrics() { if (awsRequestMetrics.isEnabled() && httpClient.getHttpClientConnectionManager() instanceof ConnPoolControl<?>) { final PoolStats stats = ((ConnPoolControl<?>) httpClient .getHttpClientConnectionManager()).getTotalStats(); awsRequestMetrics .withCounter(HttpClientPoolAvailableCount, stats.getAvailable()) .withCounter(HttpClientPoolLeasedCount, stats.getLeased()) .withCounter(HttpClientPoolPendingCount, stats.getPending()); } }
/** * Captures the connection pool metrics. */ private void captureConnectionPoolMetrics() { if (awsRequestMetrics.isEnabled() && httpClient.getHttpClientConnectionManager() instanceof ConnPoolControl<?>) { final PoolStats stats = ((ConnPoolControl<?>) httpClient .getHttpClientConnectionManager()).getTotalStats(); awsRequestMetrics .withCounter(HttpClientPoolAvailableCount, stats.getAvailable()) .withCounter(HttpClientPoolLeasedCount, stats.getLeased()) .withCounter(HttpClientPoolPendingCount, stats.getPending()); } }
@Override public int getPending() { return pool.getTotalStats().getPending(); } }
@Override public int getPending() { return getPoolStats().getPending(); }
@Override public Integer value() { // this acquires a lock on the connection pool; remove if contention sucks return getTotalStats().getPending(); } });
@Override public int getPending() { return connMgr.getTotalStats().getPending(); }
/** * 获取等待连接的队列数 * * @return */ public static int getPending() { return Holder.getTotalStats().getPending(); }
@Override public Integer getValue() { // this acquires a lock on the connection pool; remove if contention sucks return getTotalStats().getPending(); } });
/** * 获取等待连接的队列数 * * @return */ public static int getPending() { return Holder.getTotalStats().getPending(); }
public static Map<String, Integer> getConnectionPoolStats() { Map<String, Integer> stats = new HashMap<>(); PoolStats poolStats = pool.getTotalStats(); stats.put("availableConnections", poolStats.getAvailable()); stats.put("maxConnections", poolStats.getMax()); stats.put("leasedConnections", poolStats.getLeased()); stats.put("pendingConnections", poolStats.getPending()); stats.put("defaultMaxPerRoute", pool.getDefaultMaxPerRoute()); return stats; }
@Override public Map<String, String> getStatistics() { int i = 0; final Map<String, String> data = new LinkedHashMap<>(); data.put(KEYS[i++], String.valueOf(requestsExecuted.get())); data.put(KEYS[i++], humanReadableBytes(bytesSent.get(), false)); data.put(KEYS[i++], humanReadableBytes(bytesReceived.get(), false)); data.put(KEYS[i++], humanReadableBytes(bytesFromCache.get(), false)); final PoolStats cmStats = connectionManager.getTotalStats(); data.put(KEYS[i++], connectionManager.getClass().getSimpleName()); data.put(KEYS[i++], String.valueOf(cmStats.getMax())); data.put(KEYS[i++], String.valueOf(cmStats.getAvailable())); data.put(KEYS[i++], String.valueOf(cmStats.getLeased())); data.put(KEYS[i++], String.valueOf(cmStats.getPending())); return data; }
@Override public Map<String, String> getStatistics() { int i = 0; final Map<String, String> data = new LinkedHashMap<>(); data.put(KEYS[i++], String.valueOf(requestsExecuted.get())); data.put(KEYS[i++], humanReadableBytes(bytesSent.get(), false)); data.put(KEYS[i++], humanReadableBytes(bytesReceived.get(), false)); data.put(KEYS[i++], humanReadableBytes(bytesFromCache.get(), false)); final PoolStats cmStats = connectionManager.getTotalStats(); data.put(KEYS[i++], connectionManager.getClass().getSimpleName()); data.put(KEYS[i++], String.valueOf(cmStats.getMax())); data.put(KEYS[i++], String.valueOf(cmStats.getAvailable())); data.put(KEYS[i++], String.valueOf(cmStats.getLeased())); data.put(KEYS[i++], String.valueOf(cmStats.getPending())); return data; }
public static Map<String, Integer> getConnectionPoolStats() { Map<String, Integer> stats = new HashMap<>(); PoolStats poolStats = pool.getTotalStats(); stats.put("availableConnections", poolStats.getAvailable()); stats.put("maxConnections", poolStats.getMax()); stats.put("leasedConnections", poolStats.getLeased()); stats.put("pendingConnections", poolStats.getPending()); stats.put("defaultMaxPerRoute", pool.getDefaultMaxPerRoute()); return stats; }
private void warnIfStalling() { if (lastBlockedAt.isAfter(Instant.now().minusSeconds(WARN_INTERVAL_SECONDS))) { final int nBlockedThreads = scheduler.getQueue().size() - 1; // don't count the notification task itself LOG.warn("Pool \"{}\" is stalling! {} threads currently awaiting checkout. Pool stats {}", clientName, nBlockedThreads, getTotalStats()); knownRoutes.forEach(r -> LOG.warn("Pool \"{}\" route \"{}\" stats {}", clientName, r, getStats(r))); } knownRoutes.removeIf(r -> { PoolStats stats = getStats(r); return stats.getLeased() == 0 && stats.getPending() == 0; }); }
(Gauge<Integer>) () -> { return getTotalStats().getPending(); });
/** * Captures the connection pool metrics. */ private void captureConnectionPoolMetrics() { if (awsRequestMetrics.isEnabled() && httpClient.getHttpClientConnectionManager() instanceof ConnPoolControl<?>) { final PoolStats stats = ((ConnPoolControl<?>) httpClient .getHttpClientConnectionManager()).getTotalStats(); awsRequestMetrics .withCounter(HttpClientPoolAvailableCount, stats.getAvailable()) .withCounter(HttpClientPoolLeasedCount, stats.getLeased()) .withCounter(HttpClientPoolPendingCount, stats.getPending()); } }
private void captureConnectionPoolMetrics(AwsRequestMetrics awsRequestMetrics) { if (awsRequestMetrics.isEnabled() && httpClient.getHttpClientConnectionManager() instanceof ConnPoolControl<?>) { ConnPoolControl<?> control = (ConnPoolControl<?>) httpClient.getHttpClientConnectionManager(); awsRequestMetrics .withCounter(AwsRequestMetrics.Field.HttpClientPoolAvailableCount, control.getTotalStats().getAvailable()) .withCounter(AwsRequestMetrics.Field.HttpClientPoolLeasedCount, control.getTotalStats().getLeased()) .withCounter(AwsRequestMetrics.Field.HttpClientPoolPendingCount, control.getTotalStats().getPending()); } }
/** * Captures the connection pool metrics. */ private void captureConnectionPoolMetrics(KscRequestMetrics kscRequestMetrics) { if (kscRequestMetrics.isEnabled() && httpClient.getHttpClientConnectionManager() instanceof ConnPoolControl<?>) { ConnPoolControl<?> control = (ConnPoolControl<?>) httpClient .getHttpClientConnectionManager(); kscRequestMetrics .withCounter(HttpClientPoolAvailableCount, control.getTotalStats().getAvailable()) .withCounter(HttpClientPoolLeasedCount, control.getTotalStats().getLeased()) .withCounter(HttpClientPoolPendingCount, control.getTotalStats().getPending()); } }