querytracer

package
v0.62.3 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2025 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func New(enabled bool, format string, args ...any) *Tracer

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

func (t *Tracer) AddChildWithSpan(span *Span)

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

func (t *Tracer) Donef(format string, args ...any)

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) Enabled

func (t *Tracer) Enabled() bool

Enabled returns true if the t is enabled.

func (*Tracer) NewChild

func (t *Tracer) NewChild(format string, args ...any) *Tracer

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.

func (*Tracer) Printf

func (t *Tracer) Printf(format string, args ...any)

Printf adds new fmt.Sprintf(format, args...) message to t.

Printf cannot be called from concurrent goroutines.

func (*Tracer) ToSpan

func (t *Tracer) ToSpan() *Span

Jump to

Keyboard shortcuts

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