opencensus-node icon indicating copy to clipboard operation
opencensus-node copied to clipboard

Please add an example of trace propagation.

Open GlenTiki opened this issue 5 years ago • 2 comments

I've been trying to figure out how to do trace propagation between micro-services and have been unable to figure out the api. An example will solve this for me. The example would ideally contain two running services, one to create a root span, ping the other service and propagate trace headers through the request, and for the child span to pick up the remote parent. I'd also like to see the ability to selectively create root or child spans based on the presence of the request headers in the second service.

I think documentation also needs work around this, but an example is quicker and probably easier right now.

GlenTiki avatar Jul 15 '19 15:07 GlenTiki

@thekemkid Thanks for asking this! I think https://github.com/census-instrumentation/opencensus-node/tree/master/examples/express and https://github.com/census-instrumentation/opencensus-node/tree/master/examples/http examples should give you some idea about trace propagation across multiple services. Let me know if this helps/

mayurkale22 avatar Aug 23 '19 22:08 mayurkale22

At the risk of shameless self-promotion - you can see working examples of context propagation here, albeit in Golang:

https://github.com/yuriatgoogle/opencensus-demo/tree/master/go/http

yuriatgoogle avatar Oct 07 '19 14:10 yuriatgoogle