xray

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 13 Imported by: 63

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDGenerator

type IDGenerator struct {
	sync.Mutex
	// contains filtered or unexported fields
}

IDGenerator is used for generating a new traceID and spanID

func NewIDGenerator

func NewIDGenerator() *IDGenerator

NewIDGenerator returns an IDGenerator reference used for sending traces to AWS X-Ray

func (*IDGenerator) NewIDs

func (gen *IDGenerator) NewIDs(ctx context.Context) (trace.TraceID, trace.SpanID)

NewIDs returns a non-zero trace ID and a non-zero span ID. trace ID returned is based on AWS X-Ray TraceID format.

span ID is from a randomly-chosen sequence.

func (*IDGenerator) NewSpanID

func (gen *IDGenerator) NewSpanID(ctx context.Context, traceID trace.TraceID) trace.SpanID

NewSpanID returns a non-zero span ID from a randomly-chosen sequence.

type Propagator

type Propagator struct{}

Propagator serializes Span Context to/from AWS X-Ray headers.

Example AWS X-Ray format:

X-Amzn-Trace-Id: Root={traceId};Parent={parentId};Sampled={samplingFlag}

func (Propagator) Extract

func (xray Propagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context

Extract gets a context from the carrier if it contains AWS X-Ray headers.

func (Propagator) Fields

func (xray Propagator) Fields() []string

Fields returns list of fields used by HTTPTextFormat.

func (Propagator) Inject

func (xray Propagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier)

Inject injects a context to the carrier following AWS X-Ray format.

Jump to

Keyboard shortcuts

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