apmstreadwayamqp

package module
v2.0.0-...-6f3c223 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractTraceContext

func ExtractTraceContext(del amqp.Delivery) (apm.TraceContext, bool)

ExtractTraceContext returns apm.TraceContext from the trace information stored in the headers.

It's the client's choice how to use the provided apm.TraceContext

func InjectTraceContext

func InjectTraceContext(tc apm.TraceContext, msg amqp.Publishing)

InjectTraceContext injects the provided apm.TraceContext in the headers of amqp.Publishing

The header injected is W3C Trace-Context header used for trace propagation => "Traceparent" If the provided msg contains header with this key it will be overwritten

Types

type WrappedChannel

type WrappedChannel struct {
	*amqp.Channel
	// contains filtered or unexported fields
}

WrappedChannel wraps amqp.Channel such that Publish calls are traced, and trace context is injected into msg.Headers.

Trace context must be supplied using Channel.WithContext. Publish calls ch.Publish. NOTE: ctx is not used for cancellation.

func WrapChannel

func WrapChannel(ch *amqp.Channel) WrappedChannel

WrapChannel wraps ampq.Channel and returns apmstreadwayamqp.WrappedChannel which wraps amqp.Channel in a traced manner

func (WrappedChannel) Publish

func (c WrappedChannel) Publish(exchange, key string, mandatory, immediate bool, msg amqp.Publishing) error

Publish publishes a message and returns an error if encountered.

Publish will trace the operation as a span if the context associated with the channel (i.e. supplied with WithContext) contains an `*apm.Transaction.`. The trace context will be propagated as headers in the published message.

func (WrappedChannel) WithContext

func (c WrappedChannel) WithContext(ctx context.Context) WrappedChannel

WithContext supplies context.Context to apmstreadwayamqp.WrappedChannel.

Jump to

Keyboard shortcuts

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