trace

package
v0.0.0-...-30f5ca6 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ServiceKey      = tag.New("service")
	ComponentKey    = tag.New("component")
	ErrorKey        = tag.New("error")
	SpanIDKey       = tag.New("span_id")
	TraceIDKey      = tag.New("trace_id")
	ParentSpanIDKey = tag.New("parent_span_id")
	MessageKey      = tag.New("message",
		tag.WithDescription("message text: info, error, etc"),
	)
)

Functions

func Inject

func Inject(ctx context.Context, injector Injector)

func SetError

func SetError(ctx context.Context, v bool)

func SetGlobalTracer

func SetGlobalTracer(t Tracer)

func WithSpan

func WithSpan(ctx context.Context, name string, body func(context.Context) error) error

Types

type Injector

type Injector interface {
	Inject(core.SpanContext, tag.Map)
}

type Option

type Option struct {
	// contains filtered or unexported fields
}

func ChildOf

func ChildOf(sc core.SpanContext) Option

func FollowsFrom

func FollowsFrom(sc core.SpanContext) Option

func WithAttribute

func WithAttribute(attr core.KeyValue) Option

func WithAttributes

func WithAttributes(attrs ...core.KeyValue) Option

func WithStartTime

func WithStartTime(t time.Time) Option

type Reference

type Reference struct {
	core.SpanContext
	RelationshipType
}

type RelationshipType

type RelationshipType int
const (
	ChildOfRelationship RelationshipType = iota
	FollowsFromRelationship
)

type Span

type Span interface {
	scope.Mutable

	log.Interface

	stats.Interface

	SetError(bool)

	Tracer() Tracer

	Finish()
}

func Active

func Active(ctx context.Context) Span

func Start

func Start(ctx context.Context, name string, opts ...Option) (context.Context, Span)

type Tracer

type Tracer interface {
	Start(context.Context, string, ...Option) (context.Context, Span)

	WithSpan(
		ctx context.Context,
		operation string,
		body func(ctx context.Context) error,
	) error

	WithService(name string) Tracer
	WithComponent(name string) Tracer
	WithResources(res ...core.KeyValue) Tracer

	// Note: see https://github.com/opentracing/opentracing-go/issues/127
	Inject(context.Context, Span, Injector)

	// ScopeID returns the resource scope of this tracer.
	scope.Scope
}

func GlobalTracer

func GlobalTracer() Tracer

Jump to

Keyboard shortcuts

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