etcd: github.com/etcd-io/etcd/pkg/traceutil Index | Files

package traceutil

import "github.com/etcd-io/etcd/pkg/traceutil"

Package traceutil implements tracing utilities using "context".

Index

Package Files

trace.go

Constants

const (
    TraceKey     = "trace"
    StartTimeKey = "startTime"
)

type Field Uses

type Field struct {
    Key   string
    Value interface{}
}

Field is a kv pair to record additional details of the trace.

type Trace Uses

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

func Get Uses

func Get(ctx context.Context) *Trace

func New Uses

func New(op string, lg *zap.Logger, fields ...Field) *Trace

func TODO Uses

func TODO() *Trace

TODO returns a non-nil, empty Trace

func (*Trace) AddField Uses

func (t *Trace) AddField(fields ...Field)

func (*Trace) GetStartTime Uses

func (t *Trace) GetStartTime() time.Time

func (*Trace) InsertStep Uses

func (t *Trace) InsertStep(at int, time time.Time, msg string, fields ...Field)

func (*Trace) IsEmpty Uses

func (t *Trace) IsEmpty() bool

func (*Trace) Log Uses

func (t *Trace) Log()

Log dumps all steps in the Trace

func (*Trace) LogIfLong Uses

func (t *Trace) LogIfLong(threshold time.Duration)

LogIfLong dumps logs if the duration is longer than threshold

func (*Trace) LogWithStepThreshold Uses

func (t *Trace) LogWithStepThreshold(threshold time.Duration)

LogWithStepThreshold only dumps step whose duration is longer than step threshold

func (*Trace) SetStartTime Uses

func (t *Trace) SetStartTime(time time.Time)

func (*Trace) StartSubTrace Uses

func (t *Trace) StartSubTrace(fields ...Field)

StartSubTrace adds step to trace as a start sign of sublevel trace All steps in the subtrace will log out the input fields of this function

func (*Trace) Step Uses

func (t *Trace) Step(msg string, fields ...Field)

Step adds step to trace

func (*Trace) StepWithFunction Uses

func (t *Trace) StepWithFunction(f func(), msg string, fields ...Field)

StepWithFunction will measure the input function as a single step

func (*Trace) StopSubTrace Uses

func (t *Trace) StopSubTrace(fields ...Field)

StopSubTrace adds step to trace as a end sign of sublevel trace All steps in the subtrace will log out the input fields of this function

Package traceutil imports 6 packages (graph). Updated 2020-04-07. Refresh now. Tools for package owners.