Skip to content

Commit

Permalink
Merge 1a2eb58 into 4bf4b69
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlias authored Jan 29, 2021
2 parents 4bf4b69 + 1a2eb58 commit 9bd4f6b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 59 deletions.
32 changes: 0 additions & 32 deletions sdk/trace/trace_go11.go

This file was deleted.

25 changes: 0 additions & 25 deletions sdk/trace/trace_nongo11.go

This file was deleted.

13 changes: 11 additions & 2 deletions sdk/trace/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package trace // import "go.opentelemetry.io/otel/sdk/trace"

import (
"context"
rt "runtime/trace"

"go.opentelemetry.io/otel/internal/trace/parent"
"go.opentelemetry.io/otel/trace"
Expand Down Expand Up @@ -65,7 +66,15 @@ func (tr *tracer) Start(ctx context.Context, name string, options ...trace.SpanO
}
}

ctx, end := startExecutionTracerTask(ctx, name)
span.executionTracerTaskEnd = end
ctx, span.executionTracerTaskEnd = func(ctx context.Context) (context.Context, func()) {
if !rt.IsEnabled() {
// Avoid additional overhead if
// runtime/trace is not enabled.
return ctx, func() {}
}
nctx, task := rt.NewTask(ctx, name)
return nctx, task.End
}(ctx)

return trace.ContextWithSpan(ctx, span), span
}

0 comments on commit 9bd4f6b

Please sign in to comment.