From 2877c047f88a2814ab12c2f5df3599b089217b5d Mon Sep 17 00:00:00 2001 From: moh-osman3 Date: Tue, 10 Sep 2024 13:35:39 -0600 Subject: [PATCH] add nil check --- receiver/otelarrowreceiver/internal/logs/otlp.go | 4 +++- receiver/otelarrowreceiver/internal/metrics/otlp.go | 4 +++- receiver/otelarrowreceiver/internal/trace/otlp.go | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/receiver/otelarrowreceiver/internal/logs/otlp.go b/receiver/otelarrowreceiver/internal/logs/otlp.go index 02a81fd813da..09dacbfd00a3 100644 --- a/receiver/otelarrowreceiver/internal/logs/otlp.go +++ b/receiver/otelarrowreceiver/internal/logs/otlp.go @@ -55,7 +55,9 @@ func (r *Receiver) Export(ctx context.Context, req plogotlp.ExportRequest) (plog } defer func() { releaseErr := r.boundedQueue.Release(sizeBytes) - r.logger.Error("Error releasing bytes from semaphore", zap.Error(releaseErr)) + if releaseErr != nil { + r.logger.Error("Error releasing bytes from semaphore", zap.Error(releaseErr)) + } }() err = r.nextConsumer.ConsumeLogs(ctx, ld) diff --git a/receiver/otelarrowreceiver/internal/metrics/otlp.go b/receiver/otelarrowreceiver/internal/metrics/otlp.go index 58796c7c044e..e4cc8dcd1def 100644 --- a/receiver/otelarrowreceiver/internal/metrics/otlp.go +++ b/receiver/otelarrowreceiver/internal/metrics/otlp.go @@ -55,7 +55,9 @@ func (r *Receiver) Export(ctx context.Context, req pmetricotlp.ExportRequest) (p } defer func() { releaseErr := r.boundedQueue.Release(sizeBytes) - r.logger.Error("Error releasing bytes from semaphore", zap.Error(releaseErr)) + if releaseErr != nil { + r.logger.Error("Error releasing bytes from semaphore", zap.Error(releaseErr)) + } }() err = r.nextConsumer.ConsumeMetrics(ctx, md) diff --git a/receiver/otelarrowreceiver/internal/trace/otlp.go b/receiver/otelarrowreceiver/internal/trace/otlp.go index a510f25fca43..d873e3324889 100644 --- a/receiver/otelarrowreceiver/internal/trace/otlp.go +++ b/receiver/otelarrowreceiver/internal/trace/otlp.go @@ -55,7 +55,9 @@ func (r *Receiver) Export(ctx context.Context, req ptraceotlp.ExportRequest) (pt } defer func() { releaseErr := r.boundedQueue.Release(sizeBytes) - r.logger.Error("Error releasing bytes from semaphore", zap.Error(releaseErr)) + if releaseErr != nil { + r.logger.Error("Error releasing bytes from semaphore", zap.Error(releaseErr)) + } }() err = r.nextConsumer.ConsumeTraces(ctx, td)