File tree Expand file tree Collapse file tree 3 files changed +50
-0
lines changed
exporter/elasticsearchexporter Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -274,6 +274,17 @@ func (cfg *Config) Validate() error {
274274 if cfg .Retry .MaxRetries < 0 {
275275 return errors .New ("retry::max_retries should be non-negative" )
276276 }
277+ if cfg .Batcher .Enabled != nil {
278+ batcherConfig := exporterbatcher.Config {
279+ Enabled : * cfg .Batcher .Enabled ,
280+ FlushTimeout : cfg .Batcher .FlushTimeout ,
281+ MinSizeConfig : cfg .Batcher .MinSizeConfig ,
282+ MaxSizeConfig : cfg .Batcher .MaxSizeConfig ,
283+ }
284+ if err := batcherConfig .Validate (); err != nil {
285+ return err
286+ }
287+ }
277288
278289 return nil
279290}
Original file line number Diff line number Diff line change @@ -425,6 +425,16 @@ func TestConfig_Validate(t *testing.T) {
425425 }),
426426 err : `must not specify both retry::max_requests and retry::max_retries` ,
427427 },
428+ "batcher max_size_items less than min_size_items" : {
429+ config : withDefaultConfig (func (cfg * Config ) {
430+ cfg .Endpoints = []string {"http://test:9200" }
431+ cfg .Batcher .MaxSizeItems = 1000
432+ cfg .Batcher .MinSizeItems = 2000
433+ enableBatcher := true
434+ cfg .Batcher .Enabled = & enableBatcher
435+ }),
436+ err : `max_size_items must be greater than or equal to min_size_items` ,
437+ },
428438 }
429439
430440 for name , tt := range tests {
Original file line number Diff line number Diff line change 1+ exporters :
2+ elasticsearch :
3+ endpoints : [https://7282951ca2294b1eb34e6bbe3a727140.us-central1.gcp.cloud.es.io:443]
4+ timeout : 10s
5+ username : fo
6+ password : bar
7+ sending_queue :
8+ enabled : true
9+ num_consumers : 2
10+ queue_size : 10
11+ batcher :
12+ enabled : true
13+ max_size_items : 1600
14+ min_size_items : 5000
15+
16+
17+ receivers :
18+ otlp :
19+ protocols :
20+ http :
21+ endpoint : " localhost:4318"
22+ grpc :
23+ endpoint : " localhost:4317"
24+
25+ service :
26+ pipelines :
27+ logs :
28+ receivers : [otlp]
29+ exporters : [elasticsearch]
You can’t perform that action at this time.
0 commit comments