public void stopClientTracer() { if (enabled) { clientTracer.setClientReceived(); } } public void startServerTracer(String contextPath) throws Exception
@Override public void executeEnd(ExecuteContext ctx) { if (ctx.type() == ExecuteType.READ) { // Don't log writes (so as to not loop on collector) brave.clientTracer().setClientReceived(); } } }
/** * Handles a Client Response. * * @param clientResponseAdapter */ public void handle(final ClientResponseAdapter clientResponseAdapter) { try { final int responseStatus = clientResponseAdapter.getStatusCode(); clientTracer.submitBinaryAnnotation(HTTP_RESPONSE_CODE_ANNOTATION, responseStatus); if (responseStatus < 200 || responseStatus > 299) { // In this case response will be the error message. clientTracer.submitAnnotation(FAILURE_ANNOTATION); } } finally { clientTracer.setClientReceived(); } } }
/** * Interface method implementation. Interprets the response and submits suitable annotation to the client tracer and also marks receipt of the response on it. * @see com.flipkart.phantom.task.spi.interceptor.ResponseInterceptor#process(java.lang.Object) */ public void process(S response, Optional<RuntimeException> transportError) { ClientTracer clientTracer = Brave.getClientTracer(this.eventDispatchingSpanCollector, this.traceFilters); if (transportError.isPresent()) { clientTracer.submitAnnotation(FAILURE_ANNOTATION); } else { final Optional<Integer> statusCode = this.getResponseStatusCode(response); if (statusCode.isPresent()) { clientTracer.submitBinaryAnnotation(RESPONSE_CODE_ANNOTATION, statusCode.get()); } if (!this.isResponseSuccess(response)) { // In this case response will be the error message. clientTracer.submitAnnotation(FAILURE_ANNOTATION); } } clientTracer.setClientReceived(); }
/** * Handle a client response. * * @param adapter Adapter that hides implementation details. */ public void handle(ClientResponseAdapter adapter) { try { for (KeyValueAnnotation annotation : adapter.responseAnnotations()) { clientTracer.submitBinaryAnnotation(annotation.getKey(), annotation.getValue()); } } finally { clientTracer.setClientReceived(); } } }
/** * Handle a client response. * * @param adapter Adapter that hides implementation details. */ public void handle(ClientResponseAdapter adapter) { try { for (KeyValueAnnotation annotation : adapter.responseAnnotations()) { clientTracer.submitBinaryAnnotation(annotation.getKey(), annotation.getValue()); } } finally { clientTracer.setClientReceived(); } } }