-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should GlobalTracer be a no-op tracer by default? #27
Comments
Having just written the JS lib to work as a no-op by default, I agree! :) I think I can say with some confidence of confidence that at least in Node -- which is the only case I've already thought this through on -- @slimsag's 2nd point is very important. If I want to use a random package off NPM in my own code, I should not need to care about where that random package uses OpenTracing or not and require me to set up a no-op implementation. Otherwise, it adds an additional setup step to use of the package (the NPM world, as I understand it, is very much a "install it and expect it to just work" kind of world) and thus package writers will be disincentivized from including OpenTracing in their packages. However, I will say there's a chance this might be a decision left to be decided on a per-platform basis. Linkage, configuration, time-of-evaluation concerns can vary a lot from between platforms -- and I would not be surprised at all if there's a case I'm not considering where not being no-op default is more correct. |
Default/global tracer already defaults to no-op impl in all langs except Java (no impl there yet). So yes, I think we should continue with that pattern. |
looking at existing tracers that have a global, ex finagle. it is no-op by
default
https://github.com/twitter/finagle/blob/develop/finagle-core/src/main/scala/com/twitter/finagle/tracing/Tracer.scala#L135
ex. if no implementation could be loaded, it does nothing.
|
I like no-op tracers as well. At AppNeta, we use them despite the fact that our instrumentation is injected, rather than built into projects. There's a few advantages, some of which are mentioned above. There's also one related consideration we might take into account in designing the tracing API, which comes out of the comment I referenced above: a goal of a no-op tracer would be to incur near-zero overhead. This is fairly easy at the API method level, e.g. have a method like For this reason, I suggest that we might consider adding an API to guard expensive work in the non-tracing or no-tracer case. Options that come to mind would be either a boolean method that determines whether tracing is occurring, or a method that invokes a callback only if valid context is present. I've opened a separate discussion for this in #31 |
@slimsag ok with you if we close this with a resounding "yes" as the answer? |
Tags are set-only, but we expose an api for getAttribute() no-op returns
null?
|
@adriancole that sounds right if we aren't supporting null attributes. |
well null is usually "I don't have this attribute". The problem we have in
exposing getAttribute is that we might end up needing to document the no-op
case.
|
I propose that the default tracer for each platform be a true noop tracer whose primary goal is to avoid performance overhead. This also means that Trace Attribute support will not work. An alternative would be to have the default tracer handle Trace Attributes and injection/extraction (nee "propagation"), but IMO that's too much work for a default anything to do. If there are no objections in the next 48 hours, I'll assume we have consensus and close this issue. |
+1. If people want just the attributes, there can be a half-op tracer. |
time to close this. @bensigelman should we add it to the semantic doc? To me the most important part is that the default tracer is safe to use in prod, its methods will not throw exceptions or anything, and generally will behave as expected, only without any side-effects. |
Yeah, for now I'd like to say that the noop tracer will not crash but has no side effects (including trace attributes). I was previously thinking that the noop tracer should support just the trace attributes, but there's really no point in that without injectors/extractors, and if we deal with those as well it's hardly a noop tracer :) It would be cool to support a trace-attributes-only Tracer someday, though. |
(and yes, good to put this in the spec: let's close this issue once that's done if there are no objections) |
As we've decided to go with having a Global tracer implementation for ease-of-use (see prior discussion at opentracing/opentracing-go#10), a thought has crossed my mind:
Thoughts?
The text was updated successfully, but these errors were encountered: