private Optional<ThrowableDescription> referenceInChildren(Throwable throwable, List<Subsegment> subsegments) { return subsegments.parallelStream() .flatMap(subsegment -> subsegment.getCause().getExceptions().stream()) .filter(throwableDescription -> throwable.equals(throwableDescription.getThrowable())) .findAny(); }
private Optional<ThrowableDescription> referenceInChildren(Throwable throwable, List<Subsegment> subsegments) { return subsegments.parallelStream() .flatMap(subsegment -> subsegment.getCause().getExceptions().stream()) .filter(throwableDescription -> throwable.equals(throwableDescription.getThrowable())) .findAny(); }
private void setRemoteForException(Subsegment subsegment, Throwable exception) { subsegment.getCause().getExceptions().forEach((e) -> { if (e.getThrowable() == exception) { e.setRemote(true); } }); }
private void setRemoteForException(Subsegment subsegment, Throwable exception) { subsegment.getCause().getExceptions().forEach((e) -> { if (e.getThrowable() == exception) { e.setRemote(true); } }); }
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); }
private void populateSubsegmentException(Subsegment subsegment, Context.FailedExecution context) { Throwable exception = context.exception(); subsegment.addException(exception); int statusCode = -1; if (exception instanceof SdkServiceException) { statusCode = ((SdkServiceException) exception).statusCode(); subsegment.getCause().setMessage(exception.getMessage()); if (((SdkServiceException) exception).isThrottlingException()) { subsegment.setThrottle(true); // throttling errors are considered client-side errors subsegment.setError(true); } setRemoteForException(subsegment, exception); } else if (context.httpResponse().isPresent()) { statusCode = context.httpResponse().get().statusCode(); } if (statusCode == -1) { return; } if (statusCode >= 400 && statusCode < 500) { subsegment.setFault(false); subsegment.setError(true); if (statusCode == 429) { subsegment.setThrottle(true); } } else if (statusCode >= 500) { subsegment.setFault(true); } }
private void populateSubsegmentException(Subsegment subsegment, Context.FailedExecution context) { Throwable exception = context.exception(); subsegment.addException(exception); int statusCode = -1; if (exception instanceof SdkServiceException) { statusCode = ((SdkServiceException) exception).statusCode(); subsegment.getCause().setMessage(exception.getMessage()); if (((SdkServiceException) exception).isThrottlingException()) { subsegment.setThrottle(true); // throttling errors are considered client-side errors subsegment.setError(true); } setRemoteForException(subsegment, exception); } else if (context.httpResponse().isPresent()) { statusCode = context.httpResponse().get().statusCode(); } if (statusCode == -1) { return; } if (statusCode >= 400 && statusCode < 500) { subsegment.setFault(false); subsegment.setError(true); if (statusCode == 429) { subsegment.setThrottle(true); } } else if (statusCode >= 500) { subsegment.setFault(true); } }