tracing

package
v2.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Profile

type Profile struct {
	Name       string
	Begin, End time.Time `json:"-"`
	Duration   time.Duration
	Children   []ProfiledSpan         `json:",omitempty"`
	KV         map[string]interface{} `json:",omitempty"`
	// contains filtered or unexported fields
}

Profile represents the profiling data for a span. It also handles the bookkeeping for the underlying span, but this is unexported so it doesn't get unmarshaled.

func (*Profile) AddChild

func (p *Profile) AddChild(child ProfiledSpan)

func (*Profile) Dump

func (p *Profile) Dump() interface{}

returns something that json could probably marshal.

func (*Profile) Finish

func (p *Profile) Finish()

func (*Profile) LogKV

func (p *Profile) LogKV(alternatingKeyValues ...interface{})

type ProfiledSpan

type ProfiledSpan interface {
	Span
	Dump() interface{} // suitable for marshaling
	AddChild(ProfiledSpan)
}

ProfiledSpan represents a span which profiles itself and its children.

func StartProfiledSpanFromContext

func StartProfiledSpanFromContext(ctx context.Context, operationName string) (ProfiledSpan, context.Context)

StartProfiledSpanFromContext returns a new child span and context from a given context using the global tracer.

type Span

type Span interface {
	// Sets the end timestamp and finalizes Span state.
	Finish()

	// Adds key/value pairs to the span.
	LogKV(alternatingKeyValues ...interface{})
}

Span represents a single span in a distributed trace.

func StartSpanFromContext

func StartSpanFromContext(ctx context.Context, operationName string) (Span, context.Context)

StartSpanFromContext returns a new child span and context from a given context using the global tracer.

type Tracer

type Tracer interface {
	// Returns a new child span and context from a given context.
	StartSpanFromContext(ctx context.Context, operationName string) (Span, context.Context)

	// Adds the required HTTP headers to pass context between nodes.
	InjectHTTPHeaders(r *http.Request)

	// Reads the HTTP headers to derive incoming context.
	ExtractHTTPHeaders(r *http.Request) (Span, context.Context)
}

Tracer implements a generic distributed tracing interface.

var GlobalTracer Tracer = NopTracer()

GlobalTracer is a single, global instance of Tracer.

func NopTracer

func NopTracer() Tracer

NopTracer returns a tracer that doesn't do anything.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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