We are trying to add tracing to micro services so it can viewed in the google Stackdriver UI. We are using Java Springboot apps deployed into Kubernetes containers, each microservices communicates over http. We’ve seen that there is Sleuth and Zipkin which if we move our RestTemplate to a bean will work. However we don’t really want to have to deploy a zipkin pod in each of our containers or create new zipkin collector pods. Ideally we would like to get this working using just the google cloud tracing sdk with using sleuth/zipkin. Playing around with the sdk we are able to get data into Stackdriver using the google cloud grpc library which just sends the data directly from the application into Stackdriver. The problem we have now is that we can send the trace id to a downstream micro service but we cannot seem to find a way to create a new span on the same trace id, it always creates a new one. I can’t seem to find any documentation on how to do this. Surely what we are doing is what this library was build for? Any pointers help on this would be great.
Adding a bit more info......
I cannot supply actual code because this is my problem, I can't actually find what I want to do.
Let me try to explain with a bit of code/pseudo code.
So lets assume this scenario, I have 3 microservices, A, B and C.
Microservice A (top level where trace is created)
TraceContext context = tracer.startSpan("myspan1");
TraceId traceId = context.getHandle().getCurrentSpanContext().getTraceId();
Call Microservice B over http passing traceId in the B3-X-TraceId header
tracer.endSpan(context);
MicroService B
Read B3-X-TraceId from header
So at this point I want to call Microservice C but I want to create a new span on the same trace
I just do not see any mechanism to do this and this is where I'm stuck.
This is what I want to do in pseudo code
TraceContext context = tracer.startSpan("myspan2");
attach the trace id that came in the header to the context
Call Microservice C over http passing traceId in the B3-X-TraceId header
tracer.endSpan(context);
Hope this makes sense in what I'm trying to do.