@Override public void filter(ClientRequestContext clientRequestContext) throws IOException { final HttpClientRequest req = new JaxRs2HttpClientRequest(clientRequestContext); requestInterceptor.handle(new HttpClientRequestAdapter(req, spanNameProvider)); } }
Span startSpan(HttpClientRequest request) { HttpClientRequestAdapter adapter = new HttpClientRequestAdapter(request, nameProvider); requestInterceptor.handle(adapter); Span span = clientSpanThreadBinder.getCurrentClientSpan(); clientSpanThreadBinder.setCurrentSpan(null); return span; }
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { if ("com.alibaba.dubbo.monitor.MonitorService".equals(invoker.getInterface().getName())) { return invoker.invoke(invocation); } RpcContext context = RpcContext.getContext(); clientRequestInterceptor.handle(new DubboClientRequestAdapter(context, invocation)); Result result = invoker.invoke(invocation); clientResponseInterceptor.handle(new DubboClientResponseAdapter(result)); return result; }
@Override public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { clientRequestInterceptor.handle(new DubboClientRequestAdapter(invoker,invocation)); try{ Result rpcResult = invoker.invoke(invocation); clientResponseInterceptor.handle(new DubboClientResponseAdapter(rpcResult)); return rpcResult; }catch (Exception ex){ clientResponseInterceptor.handle(new DubboClientResponseAdapter(ex)); throw ex; }finally { clientSpanThreadBinder.setCurrentSpan(null); } } }
@Override public Response execute(Request request, Request.Options options) throws IOException { Map<String, Collection<String>> traceHeaders = new HashMap<>(); traceHeaders.putAll(request.headers()); Request wrappedRequest = Request.create(request.method(), request.url(), traceHeaders, request.body(), request.charset()); HttpClientRequest httpClientRequest = new TraceableHttpClientRequest(wrappedRequest); ClientRequestAdapter adapter = new HttpClientRequestAdapter(httpClientRequest, new DefaultSpanNameProvider()); requestInterceptor.handle(adapter); Response response = clientDelegate.execute(wrappedRequest, options); HttpResponse httpResponse = new TraceableHttpClientResponse(response); ClientResponseAdapter responseAdapter = new HttpClientResponseAdapter(httpResponse); responseInterceptor.handle(responseAdapter); return response; } }
public Result invoke(Invoker<?> arg0, Invocation arg1) throws RpcException { clientRequestInterceptor.handle(new GrpcClientRequestAdapter(arg1)); Map<String,String> att = arg1.getAttachments(); final Span currentClientSpan = clientSpanThreadBinder.getCurrentClientSpan(); Result result ; try { result = arg0.invoke(arg1); clientSpanThreadBinder.setCurrentSpan(currentClientSpan); clientResponseInterceptor.handle(new GrpcClientResponseAdapter(result)); } finally { clientSpanThreadBinder.setCurrentSpan(null); } return result; }