Documentation
¶
Overview ¶
Package trace provides an interface for distributed tracing
Index ¶
Constants ¶
View Source
const (
// DefaultSize of the buffer
DefaultSize = 64
)
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext returns a span from context
Types ¶
type ReadOption ¶
type ReadOption func(o *ReadOptions)
type ReadOptions ¶
type ReadOptions struct {
// Trace id
Trace string
}
type Span ¶
type Span struct {
// Id of the trace
Trace string
// name of the span
Name string
// id of the span
Id string
// parent span id
Parent string
// Start time
Started time.Time
// Duration in nano seconds
Duration time.Duration
// associated data
Metadata map[string]string
// Type
Type SpanType
}
Span is used to record an entry
func Read ¶ added in v1.1.0
func Read(opts ...ReadOption) ([]*Span, error)
type Tracer ¶
type Tracer interface {
// Start a trace
Start(ctx context.Context, name string) (context.Context, *Span)
// Finish the trace
Finish(*Span) error
// Read the traces
Read(...ReadOption) ([]*Span, error)
}
Tracer is an interface for distributed tracing
var ( DefaultTracer Tracer = new(noop) Flag = pflag.NewFlagSet("trace", pflag.ExitOnError) )
Click to show internal directories.
Click to hide internal directories.