Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Span ¶
type Span struct {
// Message is a trace message
Message string
// Duration is the duration for the current trace span.
Duration time.Duration
// Children contains children spans
Children []*Span
}
Span represents a single trace Span
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
Tracer represents query tracer.
It must be created via New call. Each created tracer must be finalized via Done or Donef call.
Tracer may contain sub-tracers (branches) in order to build tree-like execution order. Call Tracer.NewChild func for adding sub-tracer.
This was taken from VictoriaMetrics source code with some modifications. https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/lib/querytracer/tracer.go
func New ¶
New creates a new instance of the tracer with the given fmt.Sprintf(format, args...) message.
If enabled isn't set, then all function calls to the returned object will be no-op.
Done or Donef must be called when the tracer should be finished.
func (*Tracer) AddChildWithSpan ¶
AddChildWithSpan add a child span to t.
Used to add a span from another tracer over the network.
AddChildWithSpan cannot be called from concurrent goroutines.
func (*Tracer) Done ¶
func (t *Tracer) Done()
Done finishes t.
Done cannot be called multiple times. Other Tracer functions cannot be called after Done call.
func (*Tracer) Donef ¶
Donef appends the given fmt.Sprintf(format, args..) message to t and finished it.
Donef cannot be called multiple times. Other Tracer functions cannot be called after Donef call.
func (*Tracer) NewChild ¶
NewChild adds a new child Tracer to t with the given fmt.Sprintf(format, args...) message.
The returned child must be closed via Done or Donef calls.
NewChild cannot be called from concurrent goroutines. Create children tracers from a single goroutine and then pass them to concurrent goroutines.