Documentation ¶
Index ¶
- func NewContextFromConsumerMessage(ctx context.Context, message *sarama.ConsumerMessage) context.Context
- func NewProducerMessage(ctx context.Context) *sarama.ProducerMessage
- func NewSpanContextFromConsumerMessage(message *sarama.ConsumerMessage) trace.SpanContext
- func TraceAndSpanFromHeaders(headers ...*sarama.RecordHeader) (traceID trace.TraceID, spanID trace.SpanID, err error)
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 NewSpanContextFromConsumerMessage ¶ added in v0.0.2
func NewSpanContextFromConsumerMessage(message *sarama.ConsumerMessage) trace.SpanContext
NewSpanContextFromConsumerMessage returns a an initialized SpanContext, where the TraceID and the SpanID are retrieved from the the consumer message headers.
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.