This repository was archived by the owner on Mar 6, 2023. It is now read-only.

Description
func (s *spanImpl) Tracer() opentracing.Tracer {
return s.tracer
}
func (s *spanImpl) Context() opentracing.SpanContext {
return s.raw.Context
}
These functions are not taking their locks. Context() could happen concurrently to e.g. a SetBaggageItem call. For Tracer() it's less clear if it should take the lock, as it is immutable except for the DebugAssertUseAfterFinish case:
if s.tracer.options.DebugAssertUseAfterFinish {
// This makes it much more likely to catch a panic on any subsequent
// operation since s.tracer is accessed on every call to `Lock`.
// We don't call `reset()` here to preserve the logs in the Span
// which are printed when the assertion triggers.
s.tracer = nil
}
It's a question of whether we want data races to show up in that case (in addition to panics). BTW I don't understand the "s.tracer is accessed on every call to Lock" part in that comment, it doesn't seem true.
@tschottdorf