diff --git a/.chloggen/elasticexporte-batcher.yaml b/.chloggen/elasticexporte-batcher.yaml deleted file mode 100644 index 93187386474fa..0000000000000 --- a/.chloggen/elasticexporte-batcher.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# Use this changelog template to create an entry for release notes. - -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: bug_fix - -# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) -component: elasticsearchexporter - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Validate batcher config for exporter - -# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. -issues: [38072] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: - -# If your change doesn't affect end users or the exported elements of any package, -# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. -# Optional: The change log or logs in which this entry should be included. -# e.g. '[user]' or '[user, api]' -# Include 'user' if the change is relevant to end users. -# Include 'api' if there is a change to a library API. -# Default: '[user]' -change_logs: [] diff --git a/exporter/elasticsearchexporter/config.go b/exporter/elasticsearchexporter/config.go index 64cbd94fbd807..3d4756d4ef32b 100644 --- a/exporter/elasticsearchexporter/config.go +++ b/exporter/elasticsearchexporter/config.go @@ -274,11 +274,6 @@ func (cfg *Config) Validate() error { if cfg.Retry.MaxRetries < 0 { return errors.New("retry::max_retries should be non-negative") } - if batcherCfg, ok := cfg.exporterbatcherConfig(); ok { - if err := batcherCfg.Validate(); err != nil { - return fmt.Errorf("invalid batcher config: %w", err) - } - } return nil } @@ -319,18 +314,6 @@ func (cfg *Config) endpoints() ([]string, error) { return endpoints, nil } -func (cfg *Config) exporterbatcherConfig() (exporterbatcher.Config, bool) { - if cfg.Batcher.Enabled == nil { - return exporterbatcher.Config{}, false - } - return exporterbatcher.Config{ - Enabled: *cfg.Batcher.Enabled, - FlushTimeout: cfg.Batcher.FlushTimeout, - MinSizeConfig: cfg.Batcher.MinSizeConfig, - MaxSizeConfig: cfg.Batcher.MaxSizeConfig, - }, true -} - func validateEndpoint(endpoint string) error { if endpoint == "" { return errConfigEmptyEndpoint diff --git a/exporter/elasticsearchexporter/config_test.go b/exporter/elasticsearchexporter/config_test.go index c9b9f5c575143..b8009f2b95a0e 100644 --- a/exporter/elasticsearchexporter/config_test.go +++ b/exporter/elasticsearchexporter/config_test.go @@ -425,16 +425,6 @@ func TestConfig_Validate(t *testing.T) { }), err: `must not specify both retry::max_requests and retry::max_retries`, }, - "batcher max_size_items less than min_size_items": { - config: withDefaultConfig(func(cfg *Config) { - cfg.Endpoints = []string{"http://test:9200"} - cfg.Batcher.MaxSizeItems = 1000 - cfg.Batcher.MinSizeItems = 2000 - enableBatcher := true - cfg.Batcher.Enabled = &enableBatcher - }), - err: `max_size_items must be greater than or equal to min_size_items`, - }, } for name, tt := range tests { diff --git a/exporter/elasticsearchexporter/factory.go b/exporter/elasticsearchexporter/factory.go index 07120cb8a0edd..8d77b501bc280 100644 --- a/exporter/elasticsearchexporter/factory.go +++ b/exporter/elasticsearchexporter/factory.go @@ -203,8 +203,14 @@ func exporterhelperOptions( exporterhelper.WithShutdown(shutdown), exporterhelper.WithQueue(cfg.QueueSettings), } - if batcherCfg, ok := cfg.exporterbatcherConfig(); ok { - opts = append(opts, exporterhelper.WithBatcher(batcherCfg)) + if cfg.Batcher.Enabled != nil { + batcherConfig := exporterbatcher.Config{ + Enabled: *cfg.Batcher.Enabled, + FlushTimeout: cfg.Batcher.FlushTimeout, + MinSizeConfig: cfg.Batcher.MinSizeConfig, + MaxSizeConfig: cfg.Batcher.MaxSizeConfig, + } + opts = append(opts, exporterhelper.WithBatcher(batcherConfig)) // Effectively disable timeout_sender because timeout is enforced in bulk indexer. //