From 69d5218845cdb70e371019ce9a64c96ada881962 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Mon, 22 May 2023 23:23:04 +0000 Subject: [PATCH] Fix return error for batch processor when consuming Metrics and Logs Signed-off-by: Bogdan Drutu --- .chloggen/fixbatcherror.yaml | 11 +++++++++++ processor/batchprocessor/batch_processor.go | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100755 .chloggen/fixbatcherror.yaml diff --git a/.chloggen/fixbatcherror.yaml b/.chloggen/fixbatcherror.yaml new file mode 100755 index 00000000000..a89e7fbba88 --- /dev/null +++ b/.chloggen/fixbatcherror.yaml @@ -0,0 +1,11 @@ +# 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. otlpreceiver) +component: batchprocessor + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Fix return error for batch processor when consuming Metrics and Logs + +# One or more tracking issues or pull requests related to the change +issues: [7711] diff --git a/processor/batchprocessor/batch_processor.go b/processor/batchprocessor/batch_processor.go index 3274b130b39..170240e5bc1 100644 --- a/processor/batchprocessor/batch_processor.go +++ b/processor/batchprocessor/batch_processor.go @@ -343,7 +343,7 @@ func (bp *batchProcessor) ConsumeTraces(ctx context.Context, td ptrace.Traces) e func (bp *batchProcessor) ConsumeMetrics(ctx context.Context, md pmetric.Metrics) error { b, err := bp.findBatcher(ctx) if err != nil { - return nil + return err } b.newItem <- md return nil @@ -353,7 +353,7 @@ func (bp *batchProcessor) ConsumeMetrics(ctx context.Context, md pmetric.Metrics func (bp *batchProcessor) ConsumeLogs(ctx context.Context, ld plog.Logs) error { b, err := bp.findBatcher(ctx) if err != nil { - return nil + return err } b.newItem <- ld return nil