trace

package
v1.11.6 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SpanFromContext

func SpanFromContext(ctx context.Context) trace.Span

SpanFromContext is a convenience passthrough to extract the active span.

Types

type Tracer

type Tracer interface {
	Start(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)
	// StartClient begins a span explicitly marked as SpanKindClient to represent
	// an outgoing client operation (e.g., LDAP, HTTP client, Redis, etc.).
	// Optional attributes can be supplied and will be set on the span.
	StartClient(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)
}

Tracer is a narrow facade over OpenTelemetry's trace.Tracer to keep instrumentation usage simple and testable across the codebase.

Usage:

tr := trace.New("nauthilus/ldap")
ctx, sp := tr.Start(ctx, "ldap.search", attribute.String("bucket", bucket))
defer sp.End()

In tests, this interface can be replaced with a lightweight fake if needed.

func New

func New(scope string) Tracer

New creates a new Tracer tied to the given instrumentation scope.

Jump to

Keyboard shortcuts

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