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 ¶
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 ¶
FromContext returns the Span from a Context if present. The bool return value indicates whether a Span was present in the Context.
func NewSpan ¶
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 ¶
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.