result.setBody(new LengthCheckInputStream(result.getBody(), Long.parseLong(response.getHttpResponse().getHeaders().get("Content-Length")), com.amazonaws.util.LengthCheckInputStream.INCLUDE_SKIPPED_BYTES));
/** * Determine if an interrupted exception is caused by the client execution timer * interrupting the current thread or some other task interrupting the thread for another * purpose. * * @return {@link ClientExecutionTimeoutException} if the {@link InterruptedException} was * caused by the {@link ClientExecutionTimer}. Otherwise re-interrupts the current thread * and returns a {@link SdkClientException} wrapping an {@link InterruptedException} */ private RuntimeException handleInterruptedException(InterruptedException e) { if (e instanceof SdkInterruptedException) { if (((SdkInterruptedException) e).getResponse() != null) { ((SdkInterruptedException) e).getResponse().getHttpResponse().getHttpRequest().abort(); } } if (executionContext.getClientExecutionTrackerTask().hasTimeoutExpired()) { // Clear the interrupt status Thread.interrupted(); ClientExecutionTimeoutException exception = new ClientExecutionTimeoutException(); reportClientExecutionTimeout(exception); return exception; } else { Thread.currentThread().interrupt(); return new AbortedException(e); } }
if (response != null && response.getHttpResponse() != null) { responseHeaders = response.getHttpResponse().getHeaders(); statusCode = response.getHttpResponse().getStatusCode(); requestLatency = calculateRequestLatency(timingInfo); } else if (context.getException() instanceof AmazonServiceException) {
Map<String, String> headers = response.getHttpResponse().getHeaders(); String responseTimeStr = headers.get(REQUESTTIME_HEADER); long responseTime = startTime - System.currentTimeMillis(); .withAttribute("url", request.getEndpoint().toURL().toString()) .withAttribute("responseCode", Integer.toString(response.getHttpResponse().getStatusCode())) .withAttribute("timeZone", getTimeZone()) .withMetric("attempts", requestAttempts)
/** * Determine if an interrupted exception is caused by the client execution timer * interrupting the current thread or some other task interrupting the thread for another * purpose. * * @return {@link ClientExecutionTimeoutException} if the {@link InterruptedException} was * caused by the {@link ClientExecutionTimer}. Otherwise re-interrupts the current thread * and returns a {@link SdkClientException} wrapping an {@link InterruptedException} */ private RuntimeException handleInterruptedException(InterruptedException e) { if (e instanceof SdkInterruptedException) { if (((SdkInterruptedException) e).getResponse() != null) { ((SdkInterruptedException) e).getResponse().getHttpResponse().getHttpRequest().abort(); } } if (executionContext.getClientExecutionTrackerTask().hasTimeoutExpired()) { // Clear the interrupt status Thread.interrupted(); ClientExecutionTimeoutException exception = new ClientExecutionTimeoutException(); reportClientExecutionTimeout(exception); return exception; } else { Thread.currentThread().interrupt(); return new AbortedException(e); } }
if (response != null && response.getHttpResponse() != null) { responseHeaders = response.getHttpResponse().getHeaders(); statusCode = response.getHttpResponse().getStatusCode(); requestLatency = calculateRequestLatency(timingInfo); } else if (context.getException() instanceof AmazonServiceException) {
private void populateAndEndSubsegment(Subsegment currentSubsegment, Request<?> request, Response<?> response) { if (null != response) { String requestId = null; if (response.getAwsResponse() instanceof AmazonWebServiceResult<?>) { // Not all services return responses extending AmazonWebServiceResult (e.g. S3) ResponseMetadata metadata = ((AmazonWebServiceResult<?>) response.getAwsResponse()).getSdkResponseMetadata(); if (null != metadata) { requestId = metadata.getRequestId(); if (null != requestId) { currentSubsegment.putAws(REQUEST_ID_SUBSEGMENT_KEY, requestId); } } } else if (null != response.getHttpResponse()) { // S3 does not follow request id header convention if (null != response.getHttpResponse().getHeader(S3_REQUEST_ID_HEADER_KEY)) { currentSubsegment.putAws(REQUEST_ID_SUBSEGMENT_KEY, response.getHttpResponse().getHeader(S3_REQUEST_ID_HEADER_KEY)); } if (null != response.getHttpResponse().getHeader(EntityHeaderKeys.AWS.EXTENDED_REQUEST_ID_HEADER)) { currentSubsegment.putAws(EntityDataKeys.AWS.EXTENDED_REQUEST_ID_KEY, response.getHttpResponse().getHeader(EntityHeaderKeys.AWS.EXTENDED_REQUEST_ID_HEADER)); } } currentSubsegment.putAllAws(extractResponseParameters(request, response.getAwsResponse())); currentSubsegment.putAllHttp(extractHttpResponseInformation(response.getHttpResponse())); } finalizeSubsegment(request); }
result.setBody(new LengthCheckInputStream(result.getBody(), Long.parseLong(response.getHttpResponse().getHeaders().get("Content-Length")), com.amazonaws.util.LengthCheckInputStream.INCLUDE_SKIPPED_BYTES));
/** * Determine if an interrupted exception is caused by the client execution timer * interrupting the current thread or some other task interrupting the thread for another * purpose. * * @return {@link ClientExecutionTimeoutException} if the {@link InterruptedException} was * caused by the {@link ClientExecutionTimer}. Otherwise re-interrupts the current thread * and returns a {@link SdkClientException} wrapping an {@link InterruptedException} */ private RuntimeException handleInterruptedException(InterruptedException e) { if (e instanceof SdkInterruptedException) { if (((SdkInterruptedException) e).getResponse() != null) { ((SdkInterruptedException) e).getResponse().getHttpResponse().getHttpRequest().abort(); } } if (executionContext.getClientExecutionTrackerTask().hasTimeoutExpired()) { // Clear the interrupt status Thread.interrupted(); return new ClientExecutionTimeoutException(); } else { Thread.currentThread().interrupt(); return new AbortedException(e); } }
statusCode = response.getHttpResponse().getStatusCode(); } else { if (e instanceof AmazonServiceException) {