Documentation
¶
Index ¶
- Variables
- func AnnotateEndpoint(f func(int64, int64, int64) *Span, c Collector) func(server.Endpoint) server.Endpoint
- func FromHTTP(f func(int64, int64, int64) *Span) func(*http.Request) *Span
- func NewSpanFunc(host, name string) func(int64, int64, int64) *Span
- func SetRequestHeaders(h http.Header, s *Span)
- func ToContext(f func(*http.Request) *Span) func(context.Context, *http.Request) context.Context
- type Collector
- type MultiCollector
- type NopCollector
- type ScribeCollector
- type Span
Constants ¶
This section is empty.
Variables ¶
var ( // SpanContextKey represents the Span in the request context. SpanContextKey = "Zipkin-Span" // ErrSpanNotFound is returned when a Span isn't found in a context. ErrSpanNotFound = errors.New("span not found") )
Functions ¶
func AnnotateEndpoint ¶
func AnnotateEndpoint(f func(int64, int64, int64) *Span, c Collector) func(server.Endpoint) server.Endpoint
AnnotateEndpoint extracts a span from the context, adds server-receive and server-send annotations at the boundaries, and submits the span to the collector. If no span is present, a new span is generated and put in the context.
func FromHTTP ¶
FromHTTP is a helper method that allows NewSpanFunc's factory function to be easily invoked by passing an HTTP request. The span name is the HTTP method. The trace, span, and parent span IDs are taken from the request headers.
func NewSpanFunc ¶
NewSpanFunc returns a function that generates a new Zipkin span.
func SetRequestHeaders ¶
SetRequestHeaders sets up HTTP headers for a new outbound request based on the (client) span. All IDs are encoded as hex strings.
Types ¶
type Collector ¶
Collector represents a Zipkin trace collector, which is probably a set of remote endpoints.
type MultiCollector ¶
type MultiCollector []Collector
MultiCollector implements Collector by sending spans to all collectors.
func (MultiCollector) Collect ¶
func (c MultiCollector) Collect(s *Span) error
Collect implements Collector.
type NopCollector ¶
type NopCollector struct{}
NopCollector implements Collector but performs no work.
func (NopCollector) Collect ¶
func (NopCollector) Collect(*Span) error
Collect implements Collector.
type ScribeCollector ¶
type ScribeCollector struct {
// contains filtered or unexported fields
}
ScribeCollector implements Collector by forwarding spans to a Scribe service, in batches.
func (*ScribeCollector) Collect ¶
func (c *ScribeCollector) Collect(s *Span) error
Collect implements Collector.
type Span ¶
type Span struct {
// contains filtered or unexported fields
}
A Span is a named collection of annotations. It represents meaningful information about a single method call, i.e. a single request against a service. Clients should annotate the span, and submit it when the request that generated it is complete.
func NewChildSpan ¶
NewChildSpan creates a new child (client) span. If a span is present in the context, it will be interpreted as the parent.
func (*Span) AnnotateDuration ¶
AnnotateDuration annotates the span with the given value and duration.
func (*Span) Encode ¶
func (s *Span) Encode() *zipkincore.Span
Encode creates a Thrift Span from the gokit Span.
func (*Span) ParentSpanID ¶
ParentSpanID returns the ID of the span which invoked this span. It may be zero.