diff --git a/.chloggen/batch-processor-init-single-shard.yaml b/.chloggen/batch-processor-init-single-shard.yaml new file mode 100644 index 00000000000..7042a8fc35d --- /dev/null +++ b/.chloggen/batch-processor-init-single-shard.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: batchprocessor + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Move single shard batcher creation to the constructor + +# One or more tracking issues or pull requests related to the change +issues: [11594] + +# (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: + +# 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/processor/batchprocessor/batch_processor.go b/processor/batchprocessor/batch_processor.go index 146ee59420f..f06c8010033 100644 --- a/processor/batchprocessor/batch_processor.go +++ b/processor/batchprocessor/batch_processor.go @@ -129,6 +129,7 @@ func newBatchProcessor[T any](set processor.Settings, cfg *Config, batchFunc fun if len(mks) == 0 { bp.batcher = &singleShardBatcher[T]{ processor: bp, + single: bp.newShard(nil), } } else { bp.batcher = &multiShardBatcher[T]{ @@ -277,7 +278,6 @@ type singleShardBatcher[T any] struct { } func (sb *singleShardBatcher[T]) start(context.Context) error { - sb.single = sb.processor.newShard(nil) sb.single.start() return nil }