You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-29 23:07:45 +02:00
Add StartOptions to Tracer.WithSpan() (#472)
Tracer.WithSpan() will now accept StartOptions as a variadic final parameter `opts` that will be passed to the Tracer.Start() invocation that creates the Span wrapping the user-provided function.
This commit is contained in:
committed by
GitHub
parent
0f1771f374
commit
f0c70ffde0
@@ -66,8 +66,8 @@ func (tr *tracer) Start(ctx context.Context, name string, o ...apitrace.StartOpt
|
||||
return apitrace.ContextWithSpan(ctx, span), span
|
||||
}
|
||||
|
||||
func (tr *tracer) WithSpan(ctx context.Context, name string, body func(ctx context.Context) error) error {
|
||||
ctx, span := tr.Start(ctx, name)
|
||||
func (tr *tracer) WithSpan(ctx context.Context, name string, body func(ctx context.Context) error, opts ...apitrace.StartOption) error {
|
||||
ctx, span := tr.Start(ctx, name, opts...)
|
||||
defer span.End()
|
||||
|
||||
if err := body(ctx); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user