Skip to content

workflows.WithTaskSpan

workflows.WithTaskSpan(
ctx context.Context,
name string,
f func(ctx context.Context) error,
) error

Wrap a function with a tracing span using the current runner’s tracer.

WithTaskSpan is an alias for WithSpan. Use it inside a task Execute method. If the context is not a task execution context, the function runs without creating a span.

ctx context.Context required

The task execution context.

name string required

The name of the span.

f func(context.Context) error required

The function to wrap.

The error returned by f, if any.