Documentation ¶
Overview ¶
Package trace defines common-use Dapper-style tracing APIs for the Go programming language.
Package trace provides a backend-agnostic APIs and various tracing providers can be used with the package by importing various implementations of the Client interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Configure ¶
func Configure(c Client)
TODO(jbd): A big TODO, we probably don't want to set a global client.
func NewContext ¶
NewContext returns a context with the span in.
Types ¶
type Client ¶
type Client interface { NewSpan(parent []byte) (id []byte) Finish(id []byte, name string, linked [][]byte, annotations map[string][]byte, start, end time.Time) error }
Client represents a client communicates with a tracing backend. Tracing backends are supposed to implement the interface in order to provide Go support.
A Client is an HTTPCarrier if it can propagate the tracing information via an HTTP request.
If you are not a tracing provider, you will never have to interact with this interface directly.
type HTTPCarrier ¶
type HTTPCarrier interface { FromReq(req *http.Request) (id []byte, err error) ToReq(req *http.Request, id []byte) error }
HTTPCarrier represents a mechanism that can attach the tracing information into an HTTP request or extract it from one.
type Span ¶
type Span struct { ID []byte // represents the global identifier of the span. Annotations map[string][]byte // annotations set on this span. }
Span represents a work.
func FromContext ¶
FromContext returns a span from the given context.
func FromHTTPReq ¶
FromHTTPReq creates a *Span from an incoming request.
An error will be returned if the current tracing client is not supporting propagation via HTTP.
func (*Span) Annotate ¶
Annotate allows you to attach data to a span. Key-value pairs are arbitary information you want to collect in the lifetime of a span.