querytracer

package
v1.91.1-cluster Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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.

func New

func New(enabled bool, format string, args ...interface{}) *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) AddJSON

func (t *Tracer) AddJSON(jsonTrace []byte) error

AddJSON adds a sub-trace to t.

The jsonTrace must be encoded with ToJSON.

AddJSON 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 ...interface{})

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 ...interface{}) *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 ...interface{})

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

Printf cannot be called from concurrent goroutines.

func (*Tracer) String

func (t *Tracer) String() string

String returns string representation of t.

String must be called when t methods aren't called by other goroutines.

func (*Tracer) ToJSON

func (t *Tracer) ToJSON() string

ToJSON returns JSON representation of t.

ToJSON must be called when t methods aren't called by other goroutines.

Jump to

Keyboard shortcuts

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