private void collectMetrics0(Request<?> request, Response<?> response) { AWSRequestMetrics arm = request.getAWSRequestMetrics(); if (arm == null || !arm.isEnabled()) { return; } for (MetricType type: AwsSdkMetrics.getPredefinedMetrics()) { if (!(type instanceof RequestMetricType)) continue; PredefinedMetricTransformer transformer = getTransformer(); for (MetricDatum datum : transformer.toMetricData(type, request, response)) { try { if (!addMetricsToQueue(datum)) { if (log.isDebugEnabled()) { log.debug("Failed to add to the metrics queue (due to no space available) for " + type.name() + ":" + request.getServiceName()); } } } catch(RuntimeException ex) { log.warn("Failed to add to the metrics queue for " + type.name() + ":" + request.getServiceName(), ex); } } } }
/** * 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 void collectMetrics(Request<?> request, Response<?> response) { final AWSRequestMetrics metrics = request.getAWSRequestMetrics(); if (metrics.isEnabled()) { final Map<String, String> allTags = getAllTags(request); final TimingInfo timing = metrics.getTimingInfo(); for (Field counter : COUNTERS) { Optional.ofNullable(timing.getCounter(counter.name())) .filter(v -> v.longValue() > 0) .ifPresent(v -> registry.counter(metricId(counter, allTags)).increment(v.longValue())); } for (Field timer : TIMERS) { Optional.ofNullable(timing.getLastSubMeasurement(timer.name())) .filter(TimingInfo::isEndTimeKnown) .ifPresent(t -> registry.timer(metricId(timer, allTags)) .record(t.getEndTimeNano() - t.getStartTimeNano(), TimeUnit.NANOSECONDS)); } notEmpty(metrics.getProperty(Field.ThrottleException)).ifPresent(throttleExceptions -> { final Id throttling = metricId("throttling", allTags); throttleExceptions.forEach(ex -> registry.counter(throttling.withTag(TAG_THROTTLE_EXCEPTION, ex.getClass().getSimpleName())).increment()); }); } }
@Override public void collectMetrics(Request<?> request, Response<?> response) { final AWSRequestMetrics metrics = request.getAWSRequestMetrics(); if (metrics.isEnabled()) { final Map<String, String> allTags = getAllTags(request); final TimingInfo timing = metrics.getTimingInfo(); for (Field counter : COUNTERS) { Optional.ofNullable(timing.getCounter(counter.name())) .filter(v -> v.longValue() > 0) .ifPresent(v -> registry.counter(metricId(counter, allTags)).increment(v.longValue())); } for (Field timer : TIMERS) { Optional.ofNullable(timing.getLastSubMeasurement(timer.name())) .filter(TimingInfo::isEndTimeKnown) .ifPresent(t -> registry.timer(metricId(timer, allTags)) .record(t.getEndTimeNano() - t.getStartTimeNano(), TimeUnit.NANOSECONDS)); } notEmpty(metrics.getProperty(Field.ThrottleException)).ifPresent(throttleExceptions -> { final Id throttling = metricId("throttling", allTags); throttleExceptions.forEach(ex -> registry.counter(throttling.withTag(TAG_THROTTLE_EXCEPTION, ex.getClass().getSimpleName())).increment()); }); } }
private void collectMetrics0(Request<?> request, Response<?> response) { AWSRequestMetrics arm = request.getAWSRequestMetrics(); if (arm == null || !arm.isEnabled()) { return; } for (MetricType type: AwsSdkMetrics.getPredefinedMetrics()) { if (!(type instanceof RequestMetricType)) continue; PredefinedMetricTransformer transformer = getTransformer(); for (MetricDatum datum : transformer.toMetricData(type, request, response)) { try { if (!addMetricsToQueue(datum)) { if (log.isDebugEnabled()) { log.debug("Failed to add to the metrics queue (due to no space available) for " + type.name() + ":" + request.getServiceName()); } } } catch(RuntimeException ex) { log.warn("Failed to add to the metrics queue for " + type.name() + ":" + request.getServiceName(), ex); } } } }
/** * 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()); } }