Documentation
¶
Overview ¶
Package trace tracks execution across function (and machine) bounds. Build a trace with New(), and add nodes via With() or WithCaller(). Easily serialize and deserialize a Trace with String() and parse.Trace.
Index ¶
- func CheckLabel(label string) error
- type Node
- type Trace
- func (t Trace) Extend(label string) Trace
- func (t Trace) MarshalLogArray(ae zapcore.ArrayEncoder) error
- func (t Trace) MarshalZerologArray(a *zerolog.Array)
- func (t Trace) String() string
- func (t Trace) With(label string) Trace
- func (t Trace) WithCaller(skip int) Trace
- func (t Trace) WriteTo(w io.Writer) (n int64, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckLabel ¶
CheckLabel validates a label. A valid label is:
- non-empty
- contains no spaces (as unicode.IsSpace)
- does not contain the rune '!'.
Types ¶
type Node ¶
type Node struct { // Label is a user-defined tag. A label can't contain whitespace (see unicode.IsSpace) or the character '!'. Label string // ID is randomly generated as a uuidv4 when NewNode() is called. ID uuid.UUID // Start is Start time.Time }
Node is an individual point in a trace. Build with NewNode().
func NewNode ¶
NewNode makes a new node from the label. A label can't be empty, contain whitespace, or the character '!'. Such characters will be replaced with their escape: eg, ' ' => "\0x20" Such a label will panic. Use CheckLabel(label) first if you're not sure.
func (*Node) MarshalLogObject ¶
func (n *Node) MarshalLogObject(oe zapcore.ObjectEncoder) error
func (*Node) MarshalZerologObject ¶
type Trace ¶
type Trace []*Node
Trace execution across function (and machine) bounds by building a trace with New() and adding nodes at points of interest via With() or WithCaller().
func (Trace) MarshalLogArray ¶
func (t Trace) MarshalLogArray(ae zapcore.ArrayEncoder) error