apmstreadwayamqp

package module
v0.0.0-...-3e37713 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package apmrediapmstreadwayamqpgo provides helpers for tracing https://github.com/streadway/amqp

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractTraceContext

func ExtractTraceContext(ctx context.Context, tracer *apm.Tracer, del amqp.Delivery) (apm.TraceContext, error)

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

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 in encountered.

func (WrappedChannel) WithContext

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

Jump to

Keyboard shortcuts

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