saramautil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContextFromConsumerMessage

func NewContextFromConsumerMessage(ctx context.Context, message *sarama.ConsumerMessage) context.Context

NewContextFromConsumerMessage returns a context with an initialized SpanContext, where the TraceID and the SpanID are retrieved from the the consumer message headers.

func NewProducerMessage

func NewProducerMessage(ctx context.Context) *sarama.ProducerMessage

NewProducerMessage retrieves the TraceID and SpanID from the provided context and if they're both valid it'll return a *sarama.ProducerMessage with pre-populated telemetry headers, otherwise it'll return an empty initialized *sarama.ProducerMessage.

func TraceAndSpanFromHeaders

func TraceAndSpanFromHeaders(
	headers ...*sarama.RecordHeader,
) (traceID trace.TraceID, spanID trace.SpanID, err error)

TraceAndSpanFromHeaders iterates through the headers and if one of the headers matches the expected TraceID and SpanID keys, it'll attempt to parse it's hex values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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