Java Code Examples for com.amazonaws.xray.entities.Subsegment#putAllHttp()
The following examples show how to use
com.amazonaws.xray.entities.Subsegment#putAllHttp() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TracingHandler.java From aws-xray-sdk-java with Apache License 2.0 | 6 votes |
private void populateAndEndSubsegment( Subsegment currentSubsegment, Request<?> request, Response<?> response, AmazonServiceException ase) { if (null != response) { populateAndEndSubsegment(currentSubsegment, request, response); return; } else if (null != ase) { if (null != ase.getRequestId()) { currentSubsegment.putAws(REQUEST_ID_SUBSEGMENT_KEY, ase.getRequestId()); } if (null != ase.getHttpHeaders() && null != ase.getHttpHeaders().get(EntityHeaderKeys.AWS.EXTENDED_REQUEST_ID_HEADER)) { currentSubsegment.putAws(EntityDataKeys.AWS.EXTENDED_REQUEST_ID_KEY, ase.getHttpHeaders().get(EntityHeaderKeys.AWS.EXTENDED_REQUEST_ID_HEADER)); } if (null != ase.getErrorMessage()) { currentSubsegment.getCause().setMessage(ase.getErrorMessage()); } currentSubsegment.putAllHttp(extractHttpResponseInformation(ase)); } finalizeSubsegment(request); }
Example 2
Source File: TracingInterceptor.java From aws-xray-sdk-java with Apache License 2.0 | 5 votes |
private void populateSubsegmentWithResponse(Subsegment subsegment, SdkHttpResponse httpResponse) { if (subsegment == null || httpResponse == null) { return; } String extendedRequestId = extractExtendedRequestIdFromHttp(httpResponse); if (extendedRequestId != null) { subsegment.putAws(EntityDataKeys.AWS.EXTENDED_REQUEST_ID_KEY, extendedRequestId); } subsegment.putAllHttp(extractHttpResponseParameters(httpResponse)); }
Example 3
Source File: TracingHandler.java From aws-xray-sdk-java with Apache License 2.0 | 5 votes |
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); }