You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-07-15 01:04:25 +02:00
Rename CurrentSpan to SpanFromContext & SetCurrentSpan to ContextWithSpan (#379)
Signed-off-by: vineeth <vineethpothulapati@outlook.com>
This commit is contained in:
committed by
rghetia
parent
658dd7d1b9
commit
b863b8f6ab
@ -17,10 +17,10 @@ func TestSetCurrentSpanOverridesPreviouslySetSpan(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
ctx = trace.SetCurrentSpan(ctx, originalSpan)
|
||||
ctx = trace.SetCurrentSpan(ctx, expectedSpan)
|
||||
ctx = trace.ContextWithSpan(ctx, originalSpan)
|
||||
ctx = trace.ContextWithSpan(ctx, expectedSpan)
|
||||
|
||||
if span := trace.CurrentSpan(ctx); span != expectedSpan {
|
||||
if span := trace.SpanFromContext(ctx); span != expectedSpan {
|
||||
t.Errorf("Want: %v, but have: %v", expectedSpan, span)
|
||||
}
|
||||
}
|
||||
@ -38,13 +38,13 @@ func TestCurrentSpan(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "CurrentSpan() returns current span if set",
|
||||
ctx: trace.SetCurrentSpan(context.Background(), mockSpan{}),
|
||||
ctx: trace.ContextWithSpan(context.Background(), mockSpan{}),
|
||||
want: mockSpan{},
|
||||
},
|
||||
} {
|
||||
t.Run(testcase.name, func(t *testing.T) {
|
||||
// proto: CurrentSpan(ctx context.Context) trace.Span
|
||||
have := trace.CurrentSpan(testcase.ctx)
|
||||
have := trace.SpanFromContext(testcase.ctx)
|
||||
if have != testcase.want {
|
||||
t.Errorf("Want: %v, but have: %v", testcase.want, have)
|
||||
}
|
||||
|
Reference in New Issue
Block a user