Drop Tracer() method from Span API #1887
Replies: 2 comments 4 replies
-
This is a bug. The no-op span needs to return the opentelemetry-go/trace/noop.go Line 78 in d20e722 |
Beta Was this translation helpful? Give feedback.
-
I would argue that the current implementation is the right thing to do. The I don't know the use case that prompted adding the I can understand someone wanting to switch to the newly configured tracer, and that's possible by using a tracer obtained via |
Beta Was this translation helpful? Give feedback.
-
Having Tracer() method within Span API introduces a kind of confusion in terms of delegating calls to a new Tracer once TracerProvider was configured.
For better understanding let's take a look at the following code:
The problem is that
spanTracer := span.Tracer();
will return an instance ofnoopTracer
instead of an instance of internaltracer
that supports a possibility to delegate calls to an installed one when TracerProvider was configured.As a result, after SDK TracerProvider was installed we still get a
noopSpan
upon this callspanTracer.Start(context.Background(), "Span C")
.I have checked
Span
interface of other techs and have not foundTracer()
methods.Here are links to other techs: JavaScript Span API, Java Span API, PHP Span API, .NET Span API.
My proposal is to remove Tracer() method from Span API or return the internal
tracer
uponspan.Tracer();
call fornoopSpan
Beta Was this translation helpful? Give feedback.
All reactions