
Ask HN: Distributed Tracing in Node.js? - albertlie
Hi all,<p>I worked for a company more than 1 year which most of our stack is using Node.js architected in micro-service way.<p>I found difficulty on finding the best way for tracing context and error (distributed tracing) to detect issue faster. Anyone has experienced this too and been willing to share the way for dealing with this  in production system?<p>P.S: I believe most people usually passing context in function call and combine it with open tracing. But I&#x27;m not sure if there are any better ways than that in Node.js. Example of distributed tracing in Golang: https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=nm2A80PfYww
======
jcchavezs
In JS you use (if using zipkin) [https://github.com/openzipkin/zipkin-
js/tree/master/packages...](https://github.com/openzipkin/zipkin-
js/tree/master/packages/zipkin-context-cls). If you have further questions,
feel free to come to
[https://gitter.im/openzipkin/zipkin](https://gitter.im/openzipkin/zipkin) and
people will help you with more details.

------
imauld
> I believe most people usually passing context in function call and combine
> it with open tracing.

What about that is not working for you? I haven't used Node at all but I
imagine it would work about the same as described in the video you linked.

~~~
albertlie
I believe that's working but it's kind of pain because we need to passing
context across function call. So I wonder whether there is better way to do
that.

I believe node.js has async_hook feature that can capture context without
passing function call, but it's still in experimental phase and won't work for
tracing

~~~
imauld
Like I said I've never worked with Node but being explicit seems like a better
pattern than having some background async process do it.

