in producer/producer.go [117:147]
func validateProducerConfig(producerConfig *ProducerConfig, logger log.Logger) *ProducerConfig {
if producerConfig.MaxReservedAttempts <= 0 {
level.Warn(logger).Log("msg", "This MaxReservedAttempts parameter must be greater than zero,program auto correction to default value")
producerConfig.MaxReservedAttempts = 11
}
if producerConfig.MaxBatchCount > 40960 || producerConfig.MaxBatchCount <= 0 {
level.Warn(logger).Log("msg", "The parameter MaxBatchCount exceeds the set maximum and has been reset to the set maximum of 40960.")
producerConfig.MaxBatchCount = 40960
}
if producerConfig.MaxBatchSize > 1024*1024*5 || producerConfig.MaxBatchSize <= 0 {
level.Warn(logger).Log("msg", "The parameter MaxBatchSize exceeds the settable maximum and has reset a single logGroup memory size of up to 5M.")
producerConfig.MaxBatchSize = 1024 * 1024 * 5
}
if producerConfig.MaxIoWorkerCount <= 0 {
level.Warn(logger).Log("msg", "The MaxIoWorkerCount parameter cannot be less than zero and has been reset to the default value of 50")
producerConfig.MaxIoWorkerCount = 50
}
if producerConfig.BaseRetryBackoffMs <= 0 {
level.Warn(logger).Log("msg", "The BaseRetryBackoffMs parameter cannot be less than zero and has been reset to the default value of 100 milliseconds")
producerConfig.BaseRetryBackoffMs = 100
}
if producerConfig.TotalSizeLnBytes <= 0 {
level.Warn(logger).Log("msg", "The TotalSizeLnBytes parameter cannot be less than zero and has been reset to the default value of 100M")
producerConfig.TotalSizeLnBytes = 100 * 1024 * 1024
}
if producerConfig.LingerMs < 100 {
level.Warn(logger).Log("msg", "The LingerMs parameter cannot be less than 100 milliseconds and has been reset to the default value of 2000 milliseconds")
producerConfig.LingerMs = 2000
}
return producerConfig
}