-
@Autowired Tracing tracing;
-@Autowired Tracer tracer;
-
-// before you send a request, add metadata that describes the operation
-span = tracer.nextSpan().name(service + "/" + method).kind(CLIENT);
-span.tag("myrpc.version", "1.0.0");
-span.remoteServiceName("backend");
-span.remoteIpAndPort("172.3.4.1", 8108);
-
-// Add the trace context to the request, so it can be propagated in-band
-tracing.propagation().injector(Request::addHeader)
- .inject(span.context(), request);
-
-// when the request is scheduled, start the span
-span.start();
-
-// if there is an error, tag the span
-span.tag("error", error.getCode());
-// or if there is an exception
-span.error(exception);
-
-// when the response is complete, finish the span
-span.finish();
-