/** Fluent API of {@link #addProperty(MetricType, Object)} */ public final AWSRequestMetrics addPropertyWith(MetricType f, Object value) { addProperty(f, value); return this; }
final int statusCode = statusLine == null ? -1 : statusLine.getStatusCode(); if (ApacheUtils.isRequestSuccessful(execOneParams.apacheResponse)) { awsRequestMetrics.addProperty(Field.StatusCode, statusCode); .addProperty(Field.ThrottleException, exception);
/** Fluent API of {@link #addProperty(String, Object)} */ public final AWSRequestMetrics addPropertyWith(String propertyName, Object value) { addProperty(propertyName, value); return this; } /** Fluent API of {@link #addProperty(MetricType, Object)} */
final int statusCode = statusLine == null ? -1 : statusLine.getStatusCode(); if (ApacheUtils.isRequestSuccessful(execOneParams.apacheResponse)) { awsRequestMetrics.addProperty(Field.StatusCode, statusCode); .addProperty(Field.ThrottleException, exception);
/** * Capture the metrics for the given throwable. */ private <T extends Throwable> T captureExceptionMetrics(T t) { awsRequestMetrics.incrementCounterWith(Field.Exception) .addProperty(Field.Exception, t); if (t instanceof AmazonServiceException) { AmazonServiceException ase = (AmazonServiceException) t; if (RetryUtils.isThrottlingException(ase)) { awsRequestMetrics.incrementCounterWith(Field.ThrottleException) .addProperty(Field.ThrottleException, ase); } } return t; }
private void handleRetryableException(ExecOneRequestParams execOneParams, Exception e) { captureExceptionMetrics(e); awsRequestMetrics.addProperty(Field.AWSRequestID, null); SdkClientException sdkClientException; if (!(e instanceof SdkClientException)) { sdkClientException = new SdkClientException( "Unable to execute HTTP request: " + e.getMessage(), e); } else { sdkClientException = (SdkClientException) e; } boolean willRetry = shouldRetry(execOneParams, sdkClientException); if (log.isTraceEnabled()) { log.trace(sdkClientException.getMessage() + (willRetry ? " Request will be retried." : ""), e); } else if (log.isDebugEnabled()) { log.trace(sdkClientException.getMessage() + (willRetry ? " Request will be retried." : "")); } if (!willRetry) { throw lastReset(sdkClientException); } // Cache the retryable exception execOneParams.retriedException = sdkClientException; }
@Override public T handle(HttpResponse response) throws Exception { final AmazonWebServiceResponse<T> awsResponse = delegate.handle(response); if (awsResponse == null) { throw new RuntimeException("Unable to unmarshall response metadata. Response Code: " + response.getStatusCode() + ", Response Text: " + response.getStatusText()); } AmazonWebServiceRequest userRequest = request.getOriginalRequest(); if (userRequest.getCloneRoot() != null) { userRequest = userRequest.getCloneRoot(); } responseMetadataCache.add(userRequest, awsResponse.getResponseMetadata()); final String awsRequestId = awsResponse.getRequestId(); if (requestLog.isDebugEnabled()) { requestLog .debug("Received successful response: " + response.getStatusCode() + ", AWS Request ID: " + awsRequestId); } if (!logHeaderRequestId(response)) { // Logs the AWS request ID extracted from the payload if // it is not available from the response header. logResponseRequestId(awsRequestId); } awsRequestMetrics.addProperty(AWSRequestMetrics.Field.AWSRequestID, awsRequestId); return fillInResponseMetadata(awsResponse, response); }
/** Fluent API of {@link #addProperty(String, Object)} */ public final AWSRequestMetrics addPropertyWith(String propertyName, Object value) { addProperty(propertyName, value); return this; } /** Fluent API of {@link #addProperty(MetricType, Object)} */
/** Fluent API of {@link #addProperty(MetricType, Object)} */ public final AWSRequestMetrics addPropertyWith(MetricType f, Object value) { addProperty(f, value); return this; }
/** * Handles an unexpected failure, returning the Throwable instance as given. */ private <T extends Throwable> T handleUnexpectedFailure(T t, AWSRequestMetrics awsRequestMetrics) { awsRequestMetrics.incrementCounter(Field.Exception); awsRequestMetrics.addProperty(Field.Exception, t); return t; }
/** * Capture the metrics for the given throwable. */ private <T extends Throwable> T captureExceptionMetrics(T t) { awsRequestMetrics.incrementCounterWith(Field.Exception) .addProperty(Field.Exception, t); if (t instanceof AmazonServiceException) { AmazonServiceException ase = (AmazonServiceException) t; if (RetryUtils.isThrottlingException(ase)) { awsRequestMetrics.incrementCounterWith(Field.ThrottleException) .addProperty(Field.ThrottleException, ase); } } return t; }
private void handleRetryableException(ExecOneRequestParams execOneParams, Exception e) { captureExceptionMetrics(e); awsRequestMetrics.addProperty(Field.AWSRequestID, null); SdkClientException sdkClientException; if (!(e instanceof SdkClientException)) { sdkClientException = new SdkClientException( "Unable to execute HTTP request: " + e.getMessage(), e); } else { sdkClientException = (SdkClientException) e; } boolean willRetry = shouldRetry(execOneParams, sdkClientException); if (log.isTraceEnabled()) { log.trace(sdkClientException.getMessage() + (willRetry ? " Request will be retried." : ""), e); } else if (log.isDebugEnabled()) { log.trace(sdkClientException.getMessage() + (willRetry ? " Request will be retried." : "")); } if (!willRetry) { throw lastReset(sdkClientException); } // Cache the retryable exception execOneParams.retriedException = sdkClientException; }
@Override public T handle(HttpResponse response) throws Exception { final AmazonWebServiceResponse<T> awsResponse = delegate.handle(response); if (awsResponse == null) { throw new RuntimeException("Unable to unmarshall response metadata. Response Code: " + response.getStatusCode() + ", Response Text: " + response.getStatusText()); } AmazonWebServiceRequest userRequest = request.getOriginalRequest(); if (userRequest.getCloneRoot() != null) { userRequest = userRequest.getCloneRoot(); } responseMetadataCache.add(userRequest, awsResponse.getResponseMetadata()); final String awsRequestId = awsResponse.getRequestId(); if (requestLog.isDebugEnabled()) { requestLog .debug("Received successful response: " + response.getStatusCode() + ", AWS Request ID: " + awsRequestId); } if (!logHeaderRequestId(response)) { // Logs the AWS request ID extracted from the payload if // it is not available from the response header. logResponseRequestId(awsRequestId); } awsRequestMetrics.addProperty(AWSRequestMetrics.Field.AWSRequestID, awsRequestId); return fillInResponseMetadata(awsResponse, response); }
+ ", AWS Request ID: " + awsResponse.getRequestId()); awsRequestMetrics.addProperty(Field.AWSRequestID, awsResponse.getRequestId());
awsRequestMetrics.addProperty(Field.ServiceName, request.getServiceName()); awsRequestMetrics.addProperty(Field.ServiceEndpoint, request.getEndpoint()); awsRequestMetrics.addProperty(Field.StatusCode, httpResponse.getStatusCode()); request.setEndpoint(null); request.setResourcePath(null); awsRequestMetrics.addProperty(Field.StatusCode, httpResponse.getStatusCode()); awsRequestMetrics.addProperty(Field.RedirectLocation, redirectedLocation); awsRequestMetrics.addProperty(Field.AWSRequestID, null); } else { leaveHttpConnectionOpen = errorResponseHandler.needsConnectionLeftOpen(); final AmazonServiceException ase = handleErrorResponse(request, errorResponseHandler, httpResponse); awsRequestMetrics.addProperty(Field.AWSRequestID, ase.getRequestId()); awsRequestMetrics.addProperty(Field.AWSErrorCode, ase.getErrorCode()); awsRequestMetrics.addProperty(Field.StatusCode, ase.getStatusCode()); awsRequestMetrics.addProperty(Field.Exception, ioe); awsRequestMetrics.addProperty(Field.AWSRequestID, null);
/** Fluent API of {@link #addProperty(String, Object)} */ public final AWSRequestMetrics addPropertyWith(String propertyName, Object value) { addProperty(propertyName, value); return this; } /** Fluent API of {@link #addProperty(MetricType, Object)} */
/** Fluent API of {@link #addProperty(MetricType, Object)} */ public final AWSRequestMetrics addPropertyWith(MetricType f, Object value) { addProperty(f, value); return this; }
/** * Handles an unexpected failure, returning the Throwable instance as given. */ private <T extends Throwable> T handleUnexpectedFailure(T t, AWSRequestMetrics awsRequestMetrics) { awsRequestMetrics.incrementCounter(Field.Exception); awsRequestMetrics.addProperty(Field.Exception, t); return t; }
/** * Handles an unexpected failure, returning the Throwable instance as given. */ private <T extends Throwable> T handleUnexpectedFailure(T t, AWSRequestMetrics awsRequestMetrics) { awsRequestMetrics.incrementCounter(Field.Exception); awsRequestMetrics.addProperty(Field.Exception, t); return t; }
/** * Capture the metrics for the given throwable. */ private <T extends Throwable> T captureExceptionMetrics(T t) { awsRequestMetrics.incrementCounterWith(Field.Exception) .addProperty(Field.Exception, t); if (t instanceof AmazonServiceException) { AmazonServiceException ase = (AmazonServiceException) t; if (RetryUtils.isThrottlingException(ase)) { awsRequestMetrics.incrementCounterWith(Field.ThrottleException) .addProperty(Field.ThrottleException, ase); } } return t; }