Skip to content

Commit 0ecf613

Browse files
authored
perf: optimize SQL based database instrumentation (#955)
* perf: optimize SQL-based database instrumentation (#931, #938)
1 parent c5ec33a commit 0ecf613

16 files changed

+1851
-510
lines changed

context.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,5 @@ func ContextWithSpan(ctx context.Context, sp ot.Span) context.Context {
2222
// span, this method returns false.
2323
func SpanFromContext(ctx context.Context) (ot.Span, bool) {
2424
sp, ok := ctx.Value(activeSpanKey).(ot.Span)
25-
if !ok {
26-
return nil, false
27-
}
28-
29-
return sp, true
25+
return sp, ok
3026
}

context_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func TestSpanFromContext_WithActiveSpan(t *testing.T) {
2626
}
2727

2828
func TestSpanFromContext_NoActiveSpan(t *testing.T) {
29-
_, ok := instana.SpanFromContext(context.Background())
29+
sp, ok := instana.SpanFromContext(context.Background())
30+
assert.Equal(t, sp, nil)
3031
assert.False(t, ok)
3132
}

0 commit comments

Comments
 (0)