Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(kafka): batch processor config #429

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions pkg/output/kafka/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@ import (
)

type Config struct {
Brokers string `yaml:"brokers"`
Topic string `yaml:"topic"`
TLS bool `yaml:"tls" default:"false"`
TLSClientConfig TLSClientConfig `yaml:"tlsClientConfig"`
MaxQueueSize int `yaml:"maxQueueSize" default:"51200"`
FlushFrequency time.Duration `yaml:"flushFrequency" default:"10s"`
FlushMessages int `yaml:"flushMessages" default:"500"`
FlushBytes int `yaml:"flushBytes" default:"1000000"`
MaxRetries int `yaml:"maxRetries" default:"3"`
Compression CompressionStrategy `yaml:"compression" default:"none"`
RequiredAcks RequiredAcks `yaml:"requiredAcks" default:"leader"`
Partitioning PartitionStrategy `yaml:"partitioning" default:"none"`
Brokers string `yaml:"brokers"`
Topic string `yaml:"topic"`
TLS bool `yaml:"tls" default:"false"`
TLSClientConfig TLSClientConfig `yaml:"tlsClientConfig"`
MaxQueueSize int `yaml:"maxQueueSize" default:"51200"`
BatchTimeout time.Duration `yaml:"batchTimeout" default:"5s"`
MaxExportBatchSize int `yaml:"maxExportBatchSize" default:"512"`
Workers int `yaml:"workers" default:"5"`
FlushFrequency time.Duration `yaml:"flushFrequency" default:"10s"`
FlushMessages int `yaml:"flushMessages" default:"500"`
FlushBytes int `yaml:"flushBytes" default:"1000000"`
MaxRetries int `yaml:"maxRetries" default:"3"`
Compression CompressionStrategy `yaml:"compression" default:"none"`
RequiredAcks RequiredAcks `yaml:"requiredAcks" default:"leader"`
Partitioning PartitionStrategy `yaml:"partitioning" default:"none"`
}

type TLSClientConfig struct {
Expand Down
4 changes: 4 additions & 0 deletions pkg/output/kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ func New(name string, config *Config, log logrus.FieldLogger, filterConfig *xatu
exporter,
xatu.ImplementationLower()+"_output_"+SinkType+"_"+name,
log,
processor.WithMaxQueueSize(config.MaxQueueSize),
processor.WithBatchTimeout(config.BatchTimeout),
processor.WithMaxExportBatchSize(config.MaxExportBatchSize),
processor.WithShippingMethod(shippingMethod),
processor.WithWorkers(config.Workers),
)
if err != nil {
return nil, err
Expand Down