Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.tilebox.com/llms.txt

Use this file to discover all available pages before exploring further.

func WithSpan(
    ctx context.Context,
    name string,
    f func(ctx context.Context) error,
) error
Wrap a function with a tracing span using the current task runner’s tracer. Use WithSpan inside a task Execute method. If the context is not a task execution context, the function runs without creating a span.

Parameters

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.

Returns

The error returned by f, if any.
import (
    "context"
    "fmt"

    "github.com/tilebox/tilebox-go/workflows/v1"
)

type ProcessScene struct{}

func (t *ProcessScene) Execute(ctx context.Context) error {
    err := workflows.WithSpan(ctx, "write-output", func(ctx context.Context) error {
        // Write output here.
        return nil
    })
    if err != nil {
        return fmt.Errorf("failed to write output: %w", err)
    }

    return nil
}