natszipkin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyContext = errors.New("empty request context")

Functions

func ExtractNATS

func ExtractNATS(msg *nats.Msg) propagation.Extractor

ExtractNATS will extract a span.Context from a NATS message, using b3.Map Extract method. Ignores message if it has not span context.

func InjectNATS

func InjectNATS(msg *nats.Msg) propagation.Injector

InjectNATS will inject a span.Context into NATS message as a b3.Map, using b3.Map Inject method.

func NATSPublisherTrace

func NATSPublisherTrace(tracer *zipkin.Tracer, options ...TracerOption) kitnats.PublisherOption

NATSPublisherTrace enables native Zipkin tracing of a Go kit NATS transport Publisher.

Go kit creates NATS transport publisher per remote endpoint. This option will create a span on every request. This option will also transform every sending nats.Msg, moving nats.Msg.Data into a separate field (Data) in the natsMessageWithContext struct. This middleware will also create a span on every request and add its context (using Inject method of b3.Map) to the nats.Msg as Sc field. In case of sending a request to a service that is not using NATSSubscriberTrace option, use AllowPropagation TracerOption to disallow propagation.

func NATSSubscriberTrace

func NATSSubscriberTrace(tracer *zipkin.Tracer, options ...TracerOption) kitnats.SubscriberOption

NATSSubscriberTrace enables native Zipkin tracing of a Go kit NATS transport Subscriber.

Go kit creates NATS transport subscriber per remote endpoint. This option will create a span on every request. This option will also transform every nats.Msg, parsing it as natsMessageWithContext and passing Data value as nats.Msg Data further or will ignore it if nats.Msg Data is not the shape of natsMessageWithContext. The option will parse span context from the nats.Msg Data and use it as the parent context. It is safe using this option with the endpoints that may send not natsMessageWithContext typed messages.

Types

type ErrorChecker

type ErrorChecker func(msg *nats.Msg) error

type TracerOption

type TracerOption func(o *tracerOptions)

func AllowPropagation

func AllowPropagation(propagate bool) TracerOption

func ErrChecker

func ErrChecker(checker ErrorChecker) TracerOption

ErrChecker allows setting of errChecker function. This function, if present, will be used to check response message on errors. If if returns an error, zipkin.TagError tag will be added to a span.

func Logger

func Logger(logger log.Logger) TracerOption

func Name

func Name(name string) TracerOption

All the TracerOption functions below were taken from the tracing/zipkin/options.go file of the go-kit repo

func Tags

func Tags(tags map[string]string) TracerOption

Jump to

Keyboard shortcuts

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