opentracing/opentracing.io

How to access span on server side?

gvkarthik93 opened this issue · 1 comments

I have a client-server architecture. Microservice A is building a span using the following code and sending request to Microservice B.

@RequestMapping("/chaining")
public String chaining() {
Span span = tracer.buildSpan("build-span-test").start();
span.setBaggageItem("baggage-key", "baggage-value");
span.close();
ResponseEntity<String> response = restTemplate.getForEntity("http://localhost:8092/receive", String.class);
return "Chaining + " + response.getBody();
}

Now how can I access this span and baggage on Microservice B?

Following is the code I have for Microservice B:

@RequestMapping("/receive")
String testhome(@RequestHeader HttpHeaders headers) {
return "Response from Server";
}

I tried buldspan but it's building new span. Can you please tell me what I need to put in this code to access the span and baggage built on Microservice A in the Microservice B?