opentracingkafka

package module
v0.0.0-...-febdff4 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

README

go-kafka-client

OpenTracing Instrumentation for Kafka Client. Work in Progress...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer struct {
	*kafka.Consumer
}

Consumer is a wrapper for kafka.Consumer

func NewConsumer

func NewConsumer(conf *kafka.ConfigMap) (*Consumer, error)

NewConsumer is a constructor for wrapper Consumer.

func (*Consumer) AsyncConsumeWithSpan

func (c *Consumer) AsyncConsumeWithSpan(ctx context.Context, callback MessageCallback, errCallback ErrorCallBack)

AsyncConsumeWithSpan triggers the ConsumeWithSpan with goroutine. Note that input context does not have affect on loop. It is just used for Opentracing

func (*Consumer) ConsumeWithSpan

func (c *Consumer) ConsumeWithSpan(ctx context.Context, callback MessageCallback, errCallback ErrorCallBack)

ConsumeWithSpan consumes the kafka bus also extract the span values Note that input context does not have affect on loop. It is just used for Opentracing

type ErrorCallBack

type ErrorCallBack func(error, bool)

ErrorCallBack is a callback method for error handling. If kafka sends a error this method will be called. error returns the error that occured in kafka. bool value show the if the kafka listen loop is closed.

type MessageCallback

type MessageCallback func(context.Context, *kafka.Message)

MessageCallback is a callback method for receiving kafka messages. Span subsequent reference can be extracted from context

type Producer

type Producer struct {
	*kafka.Producer
}

Producer is a wrapper for Kafka.Producer.

func NewProducer

func NewProducer(conf *kafka.ConfigMap) (*Producer, error)

NewProducer creates a Producer. If trace is not null, trace will be usable. It uses kafka.NewProducer under the hood to initiate producer configuration.

func (*Producer) ProduceWithSpan

func (p *Producer) ProduceWithSpan(ctx context.Context, msg *kafka.Message, deliveryChan chan kafka.Event) error

ProduceWithSpan allows you to use opentracing specifications. The message that is produced, will also contain span context.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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