trace

package
v0.0.0-...-2166858 Latest Latest
Warning

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

Go to latest
Published: May 28, 2016 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package trace contains a helper interface that allows various tracing tools to be plugged in to components using this interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(parent context.Context, span Span) context.Context

NewContext returns a context based on parent with a new Span value.

Types

type Span

type Span interface {
	// StartLocal marks the beginning of a span representing time spent doing
	// work locally.
	StartLocal(label string)
	// StartClient marks the beginning of a span representing time spent acting as
	// a client and waiting for a response.
	StartClient(label string)
	// StartServer marks the beginning of a span representing time spent doing
	// work in service of a remote client request.
	StartServer(label string)
	// Finish marks the span as complete.
	Finish()
	// Annotate records a key/value pair associated with a Span. It should be
	// called between Start and Finish.
	Annotate(key string, value interface{})
}

Span represents a unit of work within a trace. After creating a Span with NewSpan(), call one of the Start methods to mark the beginning of the work represented by this Span. Call Finish() when that work is done to record the Span. A Span may be reused by calling Start again.

func FromContext

func FromContext(ctx context.Context) (Span, bool)

FromContext returns the Span from a Context if present. The bool return value indicates whether a Span was present in the Context.

func NewSpan

func NewSpan(parent Span) Span

NewSpan creates a new Span with the currently installed tracing plugin. If no tracing plugin is installed, it returns a fake Span that does nothing.

func NewSpanFromContext

func NewSpanFromContext(ctx context.Context) Span

NewSpanFromContext returns a new Span whose parent is the Span from the given Context if present, or a new Span with no parent if not.

Jump to

Keyboard shortcuts

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