exporter

package
v0.0.0-...-1f7aab1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxAttempts = 3
	DefaultBatchSize   = 16
)

Variables

This section is empty.

Functions

func MapCodecString

func MapCodecString(codec string) (kafka.Compression, error)

MapCodecString maps a codec string to a kafka.Compression.

Types

type Exporter

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

func New

func New(
	source *processor.KafkaMessageBuffer,
	topic string,
	brokers []string,
	opts ...Option,
) *Exporter

func (*Exporter) Export

func (e *Exporter) Export(ctx context.Context) error

Export reads messages from the source buffer and writes them to the Kafka topic. It returns an error in case of encountering a fatal error caused by the misconfiguration of the Kafka cluster or the exporter itself preventing further operation.

type MechanismFactory

type MechanismFactory func(username, password string) (sasl.Mechanism, error)

MechanismFactory is a function that takes a username and a password and returns a sasl.Mechanism and potentially an error.

func MapMechanismString

func MapMechanismString(mechanism string) (MechanismFactory, error)

MapMechanismString maps a mechanism string to a MechanismFactory.

type Option

type Option func(*Exporter)

func UseSASL

func UseSASL(mechanism sasl.Mechanism) Option

UseSASL configures the exporter to use SASL for authentication with the Kafka brokers.

func UseTLS

func UseTLS(config *tls.Config) Option

UseTLS configures the exporter to use TLS for communication with the Kafka brokers.

func WithCompression

func WithCompression(codec kafka.Compression) Option

WithCompression configures the exporter to use the specified compression codec.

func WithLogger

func WithLogger(logger *zap.Logger) Option

WithLogger sets the logger for the exporter.

type TLSData

type TLSData struct {
	CA         []byte
	Cert       []byte
	Key        []byte
	SkipVerify bool
}

func (*TLSData) Build

func (t *TLSData) Build() (*tls.Config, error)

Build creates a tls.Config from the TLSData.

Jump to

Keyboard shortcuts

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