Closed kagaya85 closed 3 years ago
I think both works, but we need to keep API forward compatbility. Does option 1 break nothing?
Does option 1 break nothing?
It returns a new value context.Context
, the numbers of return value change from 2 to 3
but we need to keep API forward compatbility.
I'm leaning toward option 2, and we can also add a CreateExitSpanWithContext
func.
Like this:
func (t *Tracer) CreateExitSpanWithContext(ctx context.Context, operationName string, peer string, injector propagation.Injector) (Span, context.Context, error)
We should not break API, as we are at 1.x stable iteration stage. I agree with @arugal, a new API makes more sense. CreateExitSpanWithContext is preferred by me.
Okay, I'll get to work on it.
In some scenarios (such as in middleware chain),span context is needed after doing
CreateExitSpan
, but theCreateExitSpan
method won't return the context that include span info right now, even can't get span info from a span objectFor the solution, IMHO, we can change the
CreateExitSpan
to return this context directly like whatCreateEntrySpan
&CreateLocalSpan
do, but this may make a BC:Another choice I considered is to expand the
Span
interface methods, add new methods likeSpanID
,TraceID
,Context
, etc.we can create a new methods collection interface with the current
Span
interface embedded, just assert to new interface when using new methodsPlease give me some advice, thanks in advance :)