richspan

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RichSpan

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

func Start

func Start(ctx context.Context) (context.Context, RichSpan)

Start starts the span.

func (RichSpan) End

func (r RichSpan) End(err *error)

End ends the span. Meant to be called in defer. Optional error argument expects a pointer to named return parameter to automatically mark span as errored.

func (RichSpan) Err

func (r RichSpan) Err(err error) error

Err records error in span and marks span as errored. Returns error without modification. Recommended use: span.Err(richerr.Wrap(err)).

func (RichSpan) Event

func (r RichSpan) Event(name string)

Event is a wrapper around otel/trace.span.AddEvent.

func (RichSpan) Log

func (r RichSpan) Log() *zerolog.Logger

func (RichSpan) Name

func (r RichSpan) Name() string

Name returns name of span.

func (RichSpan) Set

func (r RichSpan) Set(key string, val any) RichSpan

Set sets attribute to span.

func (RichSpan) Span

func (r RichSpan) Span() trace.Span

Span returns underlying otel/trace.Span.

func (RichSpan) TraceID

func (r RichSpan) TraceID() string

type SpanBuilder

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

func Name

func Name(name string) SpanBuilder

Name sets span name. If Name is not invoked before Start span name is set automatically using runtime.Caller().

func With

func With(key string, value any) SpanBuilder

With sets span attribute.

func WithArg

func WithArg(value any) SpanBuilder

WithArg sets span attribute under key "richspan.argument". Primariy meant to be for functions that take only one argument. Consecutive calls overwrite previous value.

func (SpanBuilder) Start

Start starts the span.

func (SpanBuilder) With

func (sb SpanBuilder) With(key string, value any) SpanBuilder

With sets span attribute.

func (SpanBuilder) WithArg

func (sb SpanBuilder) WithArg(value any) SpanBuilder

WithArg sets span attribute under key "richspan.argument". Primariy meant to be for functions that take only one argument. Consecutive calls overwrite previous value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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