zipkinmanager

package
v3.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (

	//TraceID is the constant that is used by all zipkin libraries accross for tracing
	TraceID = "traceid"
	//SpanID is the constant that is used by all zipkin libraries accross for tracing
	SpanID = "spanid"
	//ParentSpanID is the constant that is used by all zipkin libraries accross for tracing
	ParentSpanID = "pid"
	//IsSampled is the constant that is used by all zipkin libraries accross for tracing
	IsSampled = "issampled"
)

Variables

This section is empty.

Functions

func NewRabbitMQCollector

func NewRabbitMQCollector(servers []string, options ...RabbitmqOption) (zipkintracer.Collector, error)

NewRabbitMQCollector returns a new rabbitmq-backed Collector. addrs should be a slice of TCP endpoints of the form "host:port".

Types

type Options

type Options func(z *ZipkinTracer)

Options sets options for zipkin tracer

func Logger

func Logger(customLogger *gologger.CustomLogger) Options

Logger sets the logger for consul Defaults to consul logger

func SetRabbitMqServers

func SetRabbitMqServers(servers []string) Options

SetRabbitMqServers will set the servers for rabbitmq server This options should be given. Defaults to localhost

func SetServiceName

func SetServiceName(name string) Options

SetServiceName will set the name of the application is zipkin should be used. else zipkin will be shown as name of the application Defaults to zipkin

func SetZipkinHTTPEndPoint

func SetZipkinHTTPEndPoint(endPoint string) Options

SetZipkinHTTPEndPoint will set the zipkin endpoint Defaults to "http://127.0.0.1:/api/v1/spans"

type RabbitMQCollector

type RabbitMQCollector struct {
	// contains filtered or unexported fields
}

RabbitMQCollector implements Collector by publishing spans to a rabbitmq broker.

func (*RabbitMQCollector) Close

func (c *RabbitMQCollector) Close() error

Close implements Collector.

func (*RabbitMQCollector) Collect

func (c *RabbitMQCollector) Collect(s *zipkincore.Span) error

Collect implements Collector.

type RabbitmqOption

type RabbitmqOption func(c *RabbitMQCollector)

RabbitmqOption sets a parameter for the rabbitmqCollector

func RabbitMQLogger

func RabbitMQLogger(customLogger *gologger.CustomLogger) RabbitmqOption

RabbitMQLogger sets the logger for consul Defaults to consul logger

func RabbitmqBatchInterval

func RabbitmqBatchInterval(d time.Duration) RabbitmqOption

RabbitmqBatchInterval sets the maximum duration we will buffer traces before emitting them to the collector. The default batch interval is 1 second.

func RabbitmqBatchSize

func RabbitmqBatchSize(n int) RabbitmqOption

RabbitmqBatchSize sets the maximum batch size, after which a collect will be triggered. The default batch size is 100 traces.

func RabbitmqMaxBacklog

func RabbitmqMaxBacklog(n int) RabbitmqOption

RabbitmqMaxBacklog sets the maximum backlog size, when batch size reaches this threshold, spans from the beginning of the batch will be disposed

func RabbitmqQueueName

func RabbitmqQueueName(t string) RabbitmqOption

RabbitmqQueueName sets the queue name on which zipkin will send messages. Defaults to "zipkin"

func RabbitmqRequestCallback

func RabbitmqRequestCallback(rc RequestCallback) RabbitmqOption

RabbitmqRequestCallback registers a callback function to adjust the collector *http.Request before it sends the request to Zipkin.

type RequestCallback

type RequestCallback func(*http.Request)

RequestCallback receives the initialized request from the Collector before sending it over the wire. This allows one to plug in additional headers or do other customization.

type ZipkinTracer

type ZipkinTracer struct {
	// contains filtered or unexported fields
}

ZipkinTracer is the structure that holds zipkin related information

func NewZipkinTracer

func NewZipkinTracer(options ...Options) *ZipkinTracer

NewZipkinTracer returns a zipkin tracer object. This is a singleton function, so will return the same instance of tracer if called multiple times. And also there will be no effect of options sent if called again.

func (*ZipkinTracer) CreateContextAndSpan

func (z *ZipkinTracer) CreateContextAndSpan(ctx context.Context, st string) (opentracing.Span, context.Context)

CreateContextAndSpan creats context from span. It will inject "traceid", "spanid", "pid", "issampled" into the context

func (*ZipkinTracer) GetSpanFromContext

func (z *ZipkinTracer) GetSpanFromContext(ctx context.Context, spanName string) opentracing.Span

GetSpanFromContext gets the span details from the context It assumes that "traceid", "spanid", "pid", "issampled" is set in the context

func (*ZipkinTracer) Getstatus

func (z *ZipkinTracer) Getstatus(ctx context.Context) bool

Getstatus checks if the grpc call is sampled or not It uses the issampled field to check

Jump to

Keyboard shortcuts

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