openzipkin / zipkin-js

Zipkin instrumentation for Node.js and browsers
Apache License 2.0
564 stars 171 forks source link

add explicit traceId parameter to everything and fix leaky instrumentation #435

Open codefromthecrypt opened 5 years ago

codefromthecrypt commented 5 years ago

Use of Tracer.setId is a bug. It has led to so many leaks and confusing "should I use scoped?" where the answer is everywhere due to routine use of Tracer.setId

While a v2 rewrite (which never allows this command) is a nice way out, it is unlikely a volunteer will muster the energy to do that, unless they have several weeks time.

Another way is to add a last parameter to everything with traceId, which allows explicit (leak-free) usage of the tracer. then, make the http instrumentation classes use that instead of perpetually leaking trace ids.

scoping should never be used for our instrumentation, in other words. scoping is only for third party code. let's stop routinely using it, which will stop the routine bugs created in nearly every package.

codefromthecrypt commented 5 years ago

@openzipkin/core I don't think we should do any more release on this repo until this issue is addressed. I spent weeks on this problem and we have a long history of silly bugs.

codefromthecrypt commented 5 years ago

@shumsky since you did such an awesome job with koa, I think you have the skills to handle this one.. question is, do you have the cycles for it?

shumsky commented 5 years ago

@adriancole let me dig into this issue a little bit.

shumsky commented 5 years ago

@adriancole Hey, sorry, looks like I can't spare time for this.

codefromthecrypt commented 5 years ago

@shumsky no biggie. how about if someone else does, could you manage to review or test?

shumsky commented 5 years ago

@adriancole oh, yes, I think I'll be able to do that.