tracing

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package tracing creates OpenTelemetry spans for job work and inserts: "foreman.work <kind>" with job id, kind, queue and attempt attributes.

tr := tracing.New(tp)
ctx, span := tr.StartWork(ctx, job.ID, job.Kind, job.Queue, job.Attempt)
defer tracing.End(span, err)

Index

Constants

View Source
const (
	AttrJobID   = attribute.Key("foreman.job.id")
	AttrKind    = attribute.Key("foreman.job.kind")
	AttrQueue   = attribute.Key("foreman.queue")
	AttrAttempt = attribute.Key("foreman.job.attempt")
	AttrCount   = attribute.Key("foreman.job.count")
)

Span attribute keys.

View Source
const InstrumentationName = "github.com/thnhdatle/foreman"

InstrumentationName identifies Foreman's tracer.

Variables

This section is empty.

Functions

func End

func End(span trace.Span, err error)

End records err on span (if any) and ends it.

Types

type Tracer

type Tracer struct {
	// contains filtered or unexported fields
}

Tracer creates Foreman spans; a nil provider disables tracing.

func New

func New(tp trace.TracerProvider) *Tracer

New returns a tracer from tp (no-op when tp is nil).

func (*Tracer) StartInsert

func (t *Tracer) StartInsert(ctx context.Context, kind string, n int) (context.Context, trace.Span)

StartInsert starts the span "foreman.insert <kind>" around an insert of n jobs.

func (*Tracer) StartWork

func (t *Tracer) StartWork(
	ctx context.Context, id int64, kind, queue string, attempt int,
) (context.Context, trace.Span)

StartWork starts the span "foreman.work <kind>" around one attempt.

Jump to

Keyboard shortcuts

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