tracing

package
v1.70.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package tracing contains tracing logic for the segmentio/kafka-go.v0 instrumentation.

WARNING: this package SHOULD NOT import segmentio/kafka-go.

The motivation of this package is to support orchestrion, which cannot use the main package because it imports the segmentio/kafka-go package, and since orchestrion modifies the library code itself, this would cause an import cycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header interface {
	GetKey() string
	GetValue() []byte
}

type KafkaConfig

type KafkaConfig struct {
	BootstrapServers string
	ConsumerGroupID  string
}

KafkaConfig holds information from the kafka config for span tags.

type KafkaHeader

type KafkaHeader struct {
	Key   string
	Value []byte
}

func (KafkaHeader) GetKey

func (h KafkaHeader) GetKey() string

func (KafkaHeader) GetValue

func (h KafkaHeader) GetValue() []byte

type Message

type Message interface {
	GetValue() []byte
	GetKey() []byte
	GetHeaders() []Header
	SetHeaders([]Header)
	GetTopic() string
	GetPartition() int
	GetOffset() int64
}

type MessageCarrier

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

A MessageCarrier implements TextMapReader/TextMapWriter for extracting/injecting traces on a kafka.Message

func NewMessageCarrier

func NewMessageCarrier(msg Message) MessageCarrier

func (MessageCarrier) ForeachKey

func (c MessageCarrier) ForeachKey(handler func(key, val string) error) error

ForeachKey conforms to the TextMapReader interface.

func (MessageCarrier) Set

func (c MessageCarrier) Set(key, val string)

Set implements TextMapWriter

type Option

type Option func(tr *Tracer)

An Option customizes the Tracer.

func WithAnalytics

func WithAnalytics(on bool) Option

WithAnalytics enables Trace Analytics for all started spans.

func WithAnalyticsRate

func WithAnalyticsRate(rate float64) Option

WithAnalyticsRate sets the sampling rate for Trace Analytics events correlated to started spans.

func WithDataStreams

func WithDataStreams() Option

WithDataStreams enables the Data Streams monitoring product features: https://www.datadoghq.com/product/data-streams-monitoring/

func WithServiceName

func WithServiceName(serviceName string) Option

WithServiceName sets the Tracer service name to serviceName.

type Tracer

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

func NewTracer

func NewTracer(kafkaCfg KafkaConfig, opts ...Option) *Tracer

func (*Tracer) FinishProduceSpan

func (*Tracer) FinishProduceSpan(span ddtrace.Span, partition int, offset int64, err error)

func (*Tracer) SetConsumeDSMCheckpoint

func (tr *Tracer) SetConsumeDSMCheckpoint(msg Message)

func (*Tracer) SetProduceDSMCheckpoint

func (tr *Tracer) SetProduceDSMCheckpoint(msg Message, writer Writer)

func (*Tracer) StartConsumeSpan

func (tr *Tracer) StartConsumeSpan(ctx context.Context, msg Message) ddtrace.Span

func (*Tracer) StartProduceSpan

func (tr *Tracer) StartProduceSpan(ctx context.Context, writer Writer, msg Message, spanOpts ...tracer.StartSpanOption) ddtrace.Span

type Writer

type Writer interface {
	GetTopic() string
}

Jump to

Keyboard shortcuts

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