zipkin

package
v0.0.0-...-319c1c7 Latest Latest
Warning

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

Go to latest
Published: May 14, 2015 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func FromHTTP(f func(int64, int64, int64) *Span) func(*http.Request) *Span

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

func NewSpanFunc(host, name string) func(int64, int64, int64) *Span

NewSpanFunc returns a function that generates a new Zipkin span.

func SetRequestHeaders

func SetRequestHeaders(h http.Header, s *Span)

SetRequestHeaders sets up HTTP headers for a new outbound request based on the (client) span. All IDs are encoded as hex strings.

func ToContext

func ToContext(f func(*http.Request) *Span) func(context.Context, *http.Request) context.Context

ToContext returns a function that satisfies transport/http.BeforeFunc. When invoked, it generates a Zipkin span from the incoming HTTP request, and saves it in the request context under the SpanContextKey.

Types

type Collector

type Collector interface {
	Collect(*Span) error
}

Collector represents a Zipkin trace collector, which is probably a set of remote endpoints.

func NewScribeCollector

func NewScribeCollector(addr string, timeout time.Duration, batchSize int, batchInterval time.Duration) (Collector, error)

NewScribeCollector returns a new Scribe-backed Collector, ready for use.

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

func NewChildSpan(ctx context.Context, f func(int64, int64, int64) *Span) *Span

NewChildSpan creates a new child (client) span. If a span is present in the context, it will be interpreted as the parent.

func NewSpan

func NewSpan(host string, name string, traceID, spanID, parentSpanID int64) *Span

NewSpan returns a new Span object ready for use.

func (*Span) Annotate

func (s *Span) Annotate(value string)

Annotate annotates the span with the given value.

func (*Span) AnnotateDuration

func (s *Span) AnnotateDuration(value string, duration time.Duration)

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

func (s *Span) ParentSpanID() int64

ParentSpanID returns the ID of the span which invoked this span. It may be zero.

func (*Span) SpanID

func (s *Span) SpanID() int64

SpanID returns the ID of this span.

func (*Span) TraceID

func (s *Span) TraceID() int64

TraceID returns the ID of the trace that this span is a member of.

Jump to

Keyboard shortcuts

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