Search in sources :

Example 1 with TimingInfo

use of com.amazonaws.util.TimingInfo in project presto by prestodb.

the class PrestoS3FileSystemMetricCollector method collectMetrics.

@Override
public void collectMetrics(Request<?> request, Response<?> response) {
    AWSRequestMetrics metrics = request.getAWSRequestMetrics();
    TimingInfo timingInfo = metrics.getTimingInfo();
    Number requestCounts = timingInfo.getCounter(RequestCount.name());
    Number retryCounts = timingInfo.getCounter(HttpClientRetryCount.name());
    Number throttleExceptions = timingInfo.getCounter(ThrottleException.name());
    TimingInfo requestTime = timingInfo.getSubMeasurement(HttpRequestTime.name());
    TimingInfo clientExecuteTime = timingInfo.getSubMeasurement(ClientExecuteTime.name());
    if (requestCounts != null) {
        stats.updateAwsRequestCount(requestCounts.longValue());
    }
    if (retryCounts != null) {
        stats.updateAwsRetryCount(retryCounts.longValue());
    }
    if (throttleExceptions != null) {
        stats.updateAwsThrottleExceptionsCount(throttleExceptions.longValue());
    }
    if (requestTime != null && requestTime.getTimeTakenMillisIfKnown() != null) {
        stats.addAwsRequestTime(new Duration(requestTime.getTimeTakenMillisIfKnown(), MILLISECONDS));
    }
    if (clientExecuteTime != null && clientExecuteTime.getTimeTakenMillisIfKnown() != null) {
        stats.addAwsClientExecuteTime(new Duration(clientExecuteTime.getTimeTakenMillisIfKnown(), MILLISECONDS));
    }
}
Also used : TimingInfo(com.amazonaws.util.TimingInfo) AWSRequestMetrics(com.amazonaws.util.AWSRequestMetrics) Duration(io.airlift.units.Duration)

Aggregations

AWSRequestMetrics (com.amazonaws.util.AWSRequestMetrics)1 TimingInfo (com.amazonaws.util.TimingInfo)1 Duration (io.airlift.units.Duration)1