trace

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HttpFormat means http carrier format.
	HttpFormat = iota
	// GrpcFormat means grpc carrier format.
	GrpcFormat
)

Variables

View Source
var ErrInvalidCarrier = errors.New("invalid carrier")

ErrInvalidCarrier indicates an error that the carrier is invalid.

Functions

func StartClientSpan

func StartClientSpan(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace)

StartClientSpan starts the client span with given context, service and operation names.

func StartServerSpan

func StartServerSpan(ctx context.Context, carrier Carrier, serviceName, operationName string) (
	context.Context, tracespec.Trace)

StartServerSpan starts the server span with given context, carrier, service and operation names.

Types

type Carrier

type Carrier interface {
	Get(key string) string
	Set(key, value string)
}

Carrier interface wraps the Get and Set method.

func Extract

func Extract(format, carrier interface{}) (Carrier, error)

Extract extracts tracing information from carrier with given format.

func Inject

func Inject(format, carrier interface{}) (Carrier, error)

Inject injects tracing information into carrier with given format.

type Propagator

type Propagator interface {
	Extract(carrier interface{}) (Carrier, error)
	Inject(carrier interface{}) (Carrier, error)
}

Propagator interface wraps the Extract and Inject methods.

type Span

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

A Span is a calling span that connects caller and callee.

func (*Span) Finish

func (s *Span) Finish()

Finish finishes the calling span.

func (*Span) Follow

func (s *Span) Follow(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace)

Follow follows the tracing service and operation names in context.

func (*Span) Fork

func (s *Span) Fork(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace)

Fork forks the tracing service and operation names in context.

func (*Span) SpanId

func (s *Span) SpanId() string

SpanId returns the span id.

func (*Span) TraceId

func (s *Span) TraceId() string

TraceId returns the trace id.

func (*Span) Visit

func (s *Span) Visit(fn func(key, val string) bool)

Visit visits the span using fn.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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