Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove build flags for runtime/trace support #1498

Merged
merged 3 commits into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}