public static void endSubsegment() { globalRecorder.endSubsegment(); }
public static void endSubsegment() { globalRecorder.endSubsegment(); }
public void close() { getCreator().endSubsegment(); } }
public void close() { getCreator().endSubsegment(); } }
private void finalizeSubsegment(Request<?> request) { recorder.endSubsegment(); Long executingThreadContext = request.getHandlerContext(executingThreadKey); if (executingThreadContext != null && Thread.currentThread().getId() != executingThreadContext) { recorder.clearTraceEntity(); } }
private <R> R wrapHttpSupplier(Subsegment subsegment, HttpSupplier<R> supplier) throws IOException, ClientProtocolException { try { return supplier.get(); } catch (Exception e) { if (null != subsegment) { subsegment.addException(e); } throw e; } finally { if (null != subsegment) { recorder.endSubsegment(); } } }
private <R> R wrapHttpSupplier(Subsegment subsegment, HttpSupplier<R> supplier) throws IOException, ClientProtocolException { try { return supplier.get(); } catch (Exception e) { if (null != subsegment) { subsegment.addException(e); } throw e; } finally { if (null != subsegment) { recorder.endSubsegment(); } } }
/** * Begins a subsegment, runs the provided runnable, and ends the subsegment once complete. Intercepts exceptions, adds them to the subsegment, and re-throws them. * * @param name * the name to use for the created subsegment * @param runnable * the runnable to run */ public void createSubsegment(String name, Runnable runnable) { Subsegment subsegment = beginSubsegment(name); try { runnable.run(); } catch (Exception e) { if (subsegment != null) { subsegment.addException(e); } throw e; } finally { endSubsegment(); } }
/** * Begins a subsegment and passes it to the supplied consumer. Intercepts exceptions, adds them to the subsegment, and re-throws them. * * @param name * the name to use for the created subsegment * @param consumer * the function to invoke */ public void createSubsegment(String name, Consumer<Subsegment> consumer) { Subsegment subsegment = beginSubsegment(name); try { consumer.accept(subsegment); } catch (Exception e) { if (subsegment != null) { subsegment.addException(e); } throw e; } finally { endSubsegment(); } }
/** * Begins a subsegment and passes it to the supplied consumer. Intercepts exceptions, adds them to the subsegment, and re-throws them. * * @param name * the name to use for the created subsegment * @param consumer * the function to invoke */ public void createSubsegment(String name, Consumer<Subsegment> consumer) { Subsegment subsegment = beginSubsegment(name); try { consumer.accept(subsegment); } catch (Exception e) { if (subsegment != null) { subsegment.addException(e); } throw e; } finally { endSubsegment(); } }
/** * Begins a subsegment, runs the provided runnable, and ends the subsegment once complete. Intercepts exceptions, adds them to the subsegment, and re-throws them. * * @param name * the name to use for the created subsegment * @param runnable * the runnable to run */ public void createSubsegment(String name, Runnable runnable) { Subsegment subsegment = beginSubsegment(name); try { runnable.run(); } catch (Exception e) { if (subsegment != null) { subsegment.addException(e); } throw e; } finally { endSubsegment(); } }
/** * Begins a subsegment, passes it to the provided supplier, and ends the subsegment before returning the supplier's result. Intercepts exceptions, adds them to the subsegment, and re-throws them. * * @param <R> * the type of the value returned by {@code function} * @param name * the name to use for the created subsegment * @param supplier * the supplier to invoke * @return the value returned by the provided supplier */ public <R> R createSubsegment(String name, Supplier<R> supplier) { Subsegment subsegment = beginSubsegment(name); try { return supplier.get(); } catch (Exception e) { if (subsegment != null) { subsegment.addException(e); } throw e; } finally { endSubsegment(); } }
@Override public void onExecutionFailure(Context.FailedExecution context, ExecutionAttributes executionAttributes) { Subsegment subsegment = executionAttributes.getAttribute(entityKey); if (subsegment == null) { return; } populateSubsegmentException(subsegment, context); populateRequestId(subsegment, context); if (context.httpResponse().isPresent()) { populateSubsegmentWithResponse(subsegment, context.httpResponse().get()); } getRecorder().endSubsegment(subsegment); }
@Override public void onExecutionFailure(Context.FailedExecution context, ExecutionAttributes executionAttributes) { Subsegment subsegment = executionAttributes.getAttribute(entityKey); if (subsegment == null) { return; } populateSubsegmentException(subsegment, context); populateRequestId(subsegment, context); if (context.httpResponse().isPresent()) { populateSubsegmentWithResponse(subsegment, context.httpResponse().get()); } getRecorder().endSubsegment(subsegment); }
@Override public CloseableHttpResponse execute(HttpHost target, HttpRequest request, HttpContext context) throws IOException, ClientProtocolException { Subsegment subsegment = getRecorder().beginSubsegment(target.getHostName()); try { if (null != subsegment) { TracedHttpClient.addRequestInformation(subsegment, request, TracedHttpClient.getUrl(target, request)); } CloseableHttpResponse response = super.execute(target, request, context); if (null != subsegment) { TracedResponseHandler.addResponseInformation(subsegment, response); } return response; } catch (Exception e) { if (null != subsegment) { subsegment.addException(e); } throw e; } finally { if (null != subsegment) { getRecorder().endSubsegment(); } } }
@Override public CloseableHttpResponse execute(HttpHost target, HttpRequest request) throws IOException, ClientProtocolException { Subsegment subsegment = getRecorder().beginSubsegment(target.getHostName()); try { if (null != subsegment) { TracedHttpClient.addRequestInformation(subsegment, request, TracedHttpClient.getUrl(target, request)); } CloseableHttpResponse response = super.execute(target, request); if (null != subsegment) { TracedResponseHandler.addResponseInformation(subsegment, response); } return response; } catch (Exception e) { if (null != subsegment) { subsegment.addException(e); } throw e; } finally { if (null != subsegment) { getRecorder().endSubsegment(); } } }
@Override public CloseableHttpResponse execute(HttpUriRequest request, HttpContext context) throws IOException, ClientProtocolException { Subsegment subsegment = getRecorder().beginSubsegment(TracedHttpClient.determineTarget(request).getHostName()); try { if (null != subsegment) { TracedHttpClient.addRequestInformation(subsegment, request, TracedHttpClient.getUrl(request)); } CloseableHttpResponse response = super.execute(request, context); if (null != subsegment) { TracedResponseHandler.addResponseInformation(subsegment, response); } return response; } catch (Exception e) { if (null != subsegment) { subsegment.addException(e); } throw e; } finally { if (null != subsegment) { getRecorder().endSubsegment(); } } }
@Override public CloseableHttpResponse execute(HttpUriRequest request, HttpContext context) throws IOException, ClientProtocolException { Subsegment subsegment = getRecorder().beginSubsegment(TracedHttpClient.determineTarget(request).getHostName()); try { if (null != subsegment) { TracedHttpClient.addRequestInformation(subsegment, request, TracedHttpClient.getUrl(request)); } CloseableHttpResponse response = super.execute(request, context); if (null != subsegment) { TracedResponseHandler.addResponseInformation(subsegment, response); } return response; } catch (Exception e) { if (null != subsegment) { subsegment.addException(e); } throw e; } finally { if (null != subsegment) { getRecorder().endSubsegment(); } } }
public void afterExecution(Context.AfterExecution context, ExecutionAttributes executionAttributes) { Subsegment subsegment = executionAttributes.getAttribute(entityKey); if (subsegment == null) { return; } populateRequestId(subsegment, context); populateSubsegmentWithResponse(subsegment, context.httpResponse()); subsegment.putAllAws(extractResponseParameters(context, executionAttributes)); getRecorder().endSubsegment(subsegment); }
public void afterExecution(Context.AfterExecution context, ExecutionAttributes executionAttributes) { Subsegment subsegment = executionAttributes.getAttribute(entityKey); if (subsegment == null) { return; } populateRequestId(subsegment, context); populateSubsegmentWithResponse(subsegment, context.httpResponse()); subsegment.putAllAws(extractResponseParameters(context, executionAttributes)); getRecorder().endSubsegment(subsegment); }