-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Update to sarama v1.10.0 #2190
Update to sarama v1.10.0 #2190
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,25 @@ var ( | |
"gzip": sarama.CompressionGZIP, | ||
"snappy": sarama.CompressionSnappy, | ||
} | ||
|
||
kafkaVersions = map[string]sarama.KafkaVersion{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was first thinking something is wrong below as some "entries" were missing because the sorting on the right is not based on the version. I would probably sort based on the values on the right side. But that is more my personal preference. Just wanted to note it as I was first confused. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change ordering |
||
"": sarama.V0_8_2_0, | ||
|
||
"0.8.2.0": sarama.V0_8_2_0, | ||
"0.8.2.1": sarama.V0_8_2_1, | ||
"0.8.2.2": sarama.V0_8_2_2, | ||
"0.8.2": sarama.V0_8_2_2, | ||
"0.8": sarama.V0_8_2_2, | ||
|
||
"0.9.0.0": sarama.V0_9_0_0, | ||
"0.9.0.1": sarama.V0_9_0_1, | ||
"0.9.0": sarama.V0_9_0_1, | ||
"0.9": sarama.V0_9_0_1, | ||
|
||
"0.10.0.0": sarama.V0_10_0_0, | ||
"0.10.0": sarama.V0_10_0_0, | ||
"0.10": sarama.V0_10_0_0, | ||
} | ||
) | ||
|
||
// New instantiates a new kafka output instance. | ||
|
@@ -211,8 +230,16 @@ func newKafkaConfig(config *kafkaConfig) (*sarama.Config, error) { | |
k.Net.TLS.Enable = tls != nil | ||
k.Net.TLS.Config = tls | ||
|
||
// TODO: configure metadata level properties | ||
// use lib defaults | ||
if config.Username != "" { | ||
k.Net.SASL.Enable = true | ||
k.Net.SASL.User = config.Username | ||
k.Net.SASL.Password = config.Password | ||
} | ||
|
||
// configure metadata update properties | ||
k.Metadata.Retry.Max = config.Metadata.Retry.Max | ||
k.Metadata.Retry.Backoff = config.Metadata.Retry.Backoff | ||
k.Metadata.RefreshFrequency = config.Metadata.RefreshFreq | ||
|
||
// configure producer API properties | ||
if config.MaxMessageBytes != nil { | ||
|
@@ -237,6 +264,7 @@ func newKafkaConfig(config *kafkaConfig) (*sarama.Config, error) { | |
retryMax = 1000 | ||
} | ||
k.Producer.Retry.Max = retryMax | ||
// TODO: k.Producer.Retry.Backoff = ? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this stay in? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes. It's some samara internal config with default 100ms kinda overlapping with libbeat functionality (not critical, though). Added |
||
|
||
// configure per broker go channel buffering | ||
k.ChannelBufferSize = config.ChanBufferSize | ||
|
@@ -247,5 +275,12 @@ func newKafkaConfig(config *kafkaConfig) (*sarama.Config, error) { | |
logp.Err("Invalid kafka configuration: %v", err) | ||
return nil, err | ||
} | ||
|
||
version, ok := kafkaVersions[config.Version] | ||
if !ok { | ||
return nil, fmt.Errorf("Unknown/unsupported kafka version: %v", config.Version) | ||
} | ||
k.Version = version | ||
|
||
return k, nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if these settings are used with an older version of Kafka?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sarama lib supports kafka 0.8 - 0.10 . Settings should be valid for all kafka versions. Lib might internally ignore settings if they do not apply to the version being used. AFAIK metadata updates and publisher settings should have same effect for kafka versions.