@@ -201,14 +201,8 @@ func exporterhelperOptions(
201201 exporterhelper .WithShutdown (shutdown ),
202202 exporterhelper .WithQueue (cfg .QueueSettings ),
203203 }
204- if cfg .Batcher .Enabled != nil {
205- batcherConfig := exporterbatcher.Config {
206- Enabled : * cfg .Batcher .Enabled ,
207- FlushTimeout : cfg .Batcher .FlushTimeout ,
208- MinSizeConfig : cfg .Batcher .MinSizeConfig ,
209- MaxSizeConfig : cfg .Batcher .MaxSizeConfig ,
210- }
211- opts = append (opts , exporterhelper .WithBatcher (batcherConfig ))
204+ if batcherCfg , ok := cfg .exporterbatcherConfig (); ok {
205+ opts = append (opts , exporterhelper .WithBatcher (batcherCfg ))
212206
213207 // Effectively disable timeout_sender because timeout is enforced in bulk indexer.
214208 //
@@ -218,3 +212,15 @@ func exporterhelperOptions(
218212 }
219213 return opts
220214}
215+
216+ func (cfg * Config ) exporterbatcherConfig () (exporterbatcher.Config , bool ) {
217+ if cfg .Batcher .Enabled == nil {
218+ return exporterbatcher.Config {}, false
219+ }
220+ return exporterbatcher.Config {
221+ Enabled : * cfg .Batcher .Enabled ,
222+ FlushTimeout : cfg .Batcher .FlushTimeout ,
223+ MinSizeConfig : cfg .Batcher .MinSizeConfig ,
224+ MaxSizeConfig : cfg .Batcher .MaxSizeConfig ,
225+ }, true
226+ }
0 commit comments