-
Notifications
You must be signed in to change notification settings - Fork 108
Circular dependency with noop.js #70
Comments
Good point. Could be a remnant of the original design that required the use of delegate, which was later change to define just an API that can be implemented independently. I think the dependency should be
|
Why do we need a delegate for the GlobalTracer? Can we just ensure it's always initialized to a NoopTracer and avoid the delegation overhead?
|
Your example still requires `initGlobalTracer to be called once, but you can change it if you initialise it directly. Pretty sure it would work. |
Only thing I can think of: the delegate would let you swap out the tracer reference later, in case you already stored the reference somewhere else before the tracer was initialized. I think in my solution some portion of your code could get stuck with a I am concerned that calling |
Why do you think |
Ah, I see I am incorrect. I thought |
SGTM – I'll try to make this happen or find someone who can make this happen. :) |
Currently there are no interfaces to implement, the |
The circular dependency of Tracer -> noop -> Tracer is definitely a code smell that is worked around here with an
initialize
function that needs to be called. Why not simply remove the noop.js file, and let the tracer, span etc files export a noop instance (if we need an eagerly instantiated instance at all)?The text was updated successfully, but these errors were encountered: