Deprecate InitGlobalTracer in favor of SetGlobalTracer #128
Conversation
yurishkuro
commented
Nov 30, 2016
•
edited
edited
- Clarify the purpose of NoopTracer
My only other thought would be to make the global tracer an exported |
I'm fine with a var. But GlobalTracer isn't backwards compatible with the current method name. DefaultTracer is an option. |
Meh, I thought about it some more and like what you have here. If for some reason we decide to do more than just set the (unexported) global var someday, this will be better. |
(i.e., LGTM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a change log entry. Recommend major version bump, or alternately alias Init*
@kriskowal it's already aliased. |
// not need to keep checking if the tracer instance is nil. | ||
// | ||
// For the same reason, the NoopTracer is the default "global" tracer | ||
// (see GlobalTracer and SetGlobalTracer functions). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also note that NoopTracer is not suitable for RPC frameworks because it does not propagate baggage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a warning below. But I don't think it's fair to say that it's not suitable for RPC frameworks - it is used in TChannel, for example. Even if we took a reverse approach and built tracing on top of distributed context propagation, there'd still be a case where API for context propagation would have a no-op implementation meaning "no context propagation", and you'd have the same problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. It is perhaps too strong to claim that NoopTracer is suitable for RPC, since it would need to bring its own baggage propagation to the table like TChannel, just as it is too strong to claim that it is not suitable for RPC.
@@ -1,7 +1,8 @@ | |||
language: go | |||
|
|||
go: | |||
- 1.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't drop support for 1.5 now that you've gone 1.0 - the customer expectation is that within 1.x, there are no breaking changes. Removing this would mean we wouldn't know if 1.5 was broken within the 1.x series.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #130
// (etc) globals are noops. | ||
func InitGlobalTracer(tracer Tracer) { | ||
func SetGlobalTracer(tracer Tracer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renaming this is a backwards breaking change. Suggest creating an alias instead, or incrementing the major version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there is an alias.
@@ -25,3 +25,8 @@ func GlobalTracer() Tracer { | |||
func StartSpan(operationName string, opts ...StartSpanOption) Span { | |||
return globalTracer.StartSpan(operationName, opts...) | |||
} | |||
|
|||
// InitGlobalTracer is deprecated. Please use SetGlobalTracer. | |||
func InitGlobalTracer(tracer Tracer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
found it, thanks @bensigelman
b541c07
to
e7527cd
Compare
// not need to keep checking if the tracer instance is nil. | ||
// | ||
// For the same reason, the NoopTracer is the default "global" tracer | ||
// (see GlobalTracer and SetGlobalTracer functions). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. It is perhaps too strong to claim that NoopTracer is suitable for RPC, since it would need to bring its own baggage propagation to the table like TChannel, just as it is too strong to claim that it is not suitable for RPC.
`InitGlobalTracer` was deprecated for `SetGlobalTracer` in opentracing/opentracing-go#128