package xray

import "go.opentelemetry.io/contrib/propagators/aws/xray"

Package xray provides an OpenTelemetry propagator for the AWS XRAY propagation format.

Index

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.

Source Files

idgenerator.go propagator.go

Version
v1.37.0 (latest)
Published
Jun 25, 2025
Platform
linux/amd64
Imports
13 packages
Last checked
2 weeks ago

Tools for package owners.