minitrace

package
v0.0.0-...-4a8f52d Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2017 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package minitrace contains primitives to support propagation of tracing information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, s Span) context.Context

NewContext returns a context with the given span.

Types

type HTTPExtractor

type HTTPExtractor interface {
	SpanFromReq(req *http.Request) (Span, error)
}

HTTPExtractor allows spans to be propagated via HTTP requests.

SpanFromReq returns a span from the incoming HTTP request. If the incoming request doesn't contain trace information, a nil span is returned with no errors.

type HTTPInjector

type HTTPInjector interface {
	SpanToReq(req *http.Request, s Span) (*http.Request, error)
}

HTTPInjector allows spans to be extracted from the incoming HTTP requests.

SpanToReq mutates the outgoing request with the span, and returns a shallow copy of the request. If span is nil, req is not mutated.

type HTTPInjectorExtractor

type HTTPInjectorExtractor interface {
	HTTPInjector
	HTTPExtractor
}

HTTPInjectorExtractor combines span injection and extraction.

type Span

type Span interface {
	ID() []byte
	Annotations() []byte
}

Span represents a unit of work.

ID identifies a span globally in a tracing system.

Annotations return the labels propagated with the span. Encoding method might be tracing-backend specific.

func FromContext

func FromContext(ctx context.Context) Span

FromContext returns the span from the context.

Jump to

Keyboard shortcuts

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