Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
JekaMas committed Aug 17, 2022
1 parent 478a7e0 commit 2d68b7c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion common/tracing/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ func WithTracer(ctx context.Context, tr trace.Tracer) context.Context {
}

func FromContext(ctx context.Context) trace.Tracer {
tr, _ := ctx.Value(tracerKey{}).(trace.Tracer)
tr, ok := ctx.Value(tracerKey{}).(trace.Tracer)

if !ok {
panic("nil tracer")
}

return tr
}
Expand Down Expand Up @@ -47,6 +51,8 @@ func Exec(ctx context.Context, spanName string, opts ...Option) {

if tr != nil {
ctx, span = tr.Start(ctx, spanName)
} else {
panic("nil tracer")
}

for _, optFn := range opts {
Expand Down

0 comments on commit 2d68b7c

Please sign in to comment.