runspan

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package runspan records a run of periodic work — a worker tick, a cron run — as the root span of its own trace, for worker and cron.

ctx, span := runspan.Start(ctx, tracer, name)
var err error
finished := false // stays false when run panics
defer func() { runspan.End(span, finished, err) }()
err = run(ctx)
finished = true

Start lifts otel.Suppress from the context, so a run that asked for a span gets one even when it was started from a suppressed context. End marks a run that did not finish as a panic and a run with an error as failed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func End

func End(span trace.Span, finished bool, err error)

End ends span: a run that did not finish panicked, a run with err failed.

func Start

func Start(ctx context.Context, tracer trace.Tracer, name string) (context.Context, trace.Span)

Start opens the root span name. It lifts otel.Suppress: the sampler sees the values of ctx even for a new root, and a run that asked for a span must not lose it to a mark left on the context it was started from.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL