trace

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Trace

type Trace struct {
	Context context.Context
	Span    trace.Span
}

func NewTraceWithContext

func NewTraceWithContext(c context.Context) *Trace

NewTraceWithContext returns a new instance of a Trace object to be used for tracing.

func (*Trace) AddEvent

func (t *Trace) AddEvent(event string, attributes map[string]string)

AddEvent adds an event to the trace.

func (*Trace) Close

func (t *Trace) Close()

Close ends the trace.

func (*Trace) FailIf

func (t *Trace) FailIf(err error) error

FailIf marks the trace as failed if the error is not nil.

func (*Trace) Failedf

func (t *Trace) Failedf(format string, args ...any)

Failedf marks the trace as failed.

func (*Trace) GetTraceID

func (t *Trace) GetTraceID() string

GetTraceID returns the trace ID of the trace.

func (*Trace) RecordError

func (t *Trace) RecordError(err error, attributes map[string]string)

RecordError records an error to the trace.

func (*Trace) SetHTTPHeaders

func (t *Trace) SetHTTPHeaders(request *http.Request)

SetHTTPHeaders sets the HTTP headers for the trace.

func (*Trace) SetTag

func (t *Trace) SetTag(key, value string)

SetTag adds a tag to the trace.

func (*Trace) StartNewSpan

func (t *Trace) StartNewSpan() *Trace

StartNewSpan starts a new span with the given span name.

func (*Trace) StartNewSpanWithName

func (t *Trace) StartNewSpanWithName(spanName string) *Trace

func (*Trace) StartNewSpanf

func (t *Trace) StartNewSpanf(format string, args ...any) *Trace

StartNewSpanf starts a new span with the given span name and arguments.

Jump to

Keyboard shortcuts

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