feat(kafka): Add keep-alive period setting for input and output. (#12459)

This commit is contained in:
Sven Rebhan 2023-01-05 16:48:31 +01:00 committed by GitHub
parent 07e4e72a0c
commit 6fb08bb3da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 6 deletions

View File

@ -54,10 +54,11 @@ type Config struct {
SASLAuth
tls.ClientConfig
Version string `toml:"version"`
ClientID string `toml:"client_id"`
CompressionCodec int `toml:"compression_codec"`
EnableTLS *bool `toml:"enable_tls"`
Version string `toml:"version"`
ClientID string `toml:"client_id"`
CompressionCodec int `toml:"compression_codec"`
EnableTLS *bool `toml:"enable_tls"`
KeepAlivePeriod *tgConf.Duration `toml:"keep_alive_period"`
MetadataRetryMax int `toml:"metadata_retry_max"`
MetadataRetryType string `toml:"metadata_retry_type"`
@ -118,6 +119,11 @@ func (k *Config) SetConfig(config *sarama.Config, log telegraf.Logger) error {
}
}
if k.KeepAlivePeriod != nil {
// Defaults to OS setting (15s currently)
config.Net.KeepAlive = time.Duration(*k.KeepAlivePeriod)
}
if k.MetadataFull != nil {
// Defaults to true in Sarama
config.Metadata.Full = *k.MetadataFull

View File

@ -45,6 +45,10 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
## Period between keep alive probes.
## Defaults to the OS configuration if not specified or zero.
# keep_alive_period = "15s"
## SASL authentication credentials. These settings should typically be used
## with TLS encryption enabled
# sasl_username = "kafka"

View File

@ -25,6 +25,10 @@
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
## Period between keep alive probes.
## Defaults to the OS configuration if not specified or zero.
# keep_alive_period = "15s"
## SASL authentication credentials. These settings should typically be used
## with TLS encryption enabled
# sasl_username = "kafka"

View File

@ -95,7 +95,7 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
## 2 : Snappy
## 3 : LZ4
## 4 : ZSTD
# compression_codec = 0
# compression_codec = 0
## Idempotent Writes
## If enabled, exactly one copy of each message is written.
@ -133,6 +133,10 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
## Period between keep alive probes.
## Defaults to the OS configuration if not specified or zero.
# keep_alive_period = "15s"
## Optional SOCKS5 proxy to use when connecting to brokers
# socks5_enabled = true
# socks5_address = "127.0.0.1:1080"

View File

@ -78,7 +78,7 @@
## 2 : Snappy
## 3 : LZ4
## 4 : ZSTD
# compression_codec = 0
# compression_codec = 0
## Idempotent Writes
## If enabled, exactly one copy of each message is written.
@ -116,6 +116,10 @@
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
## Period between keep alive probes.
## Defaults to the OS configuration if not specified or zero.
# keep_alive_period = "15s"
## Optional SOCKS5 proxy to use when connecting to brokers
# socks5_enabled = true
# socks5_address = "127.0.0.1:1080"