From 0642a854173f15960993e07ffea68e4b96c7dbbf Mon Sep 17 00:00:00 2001 From: luhualin Date: Thu, 26 Nov 2020 19:05:58 +0800 Subject: [PATCH] fix collector panic due to sarama sdk Signed-off-by: luhualin --- plugin/storage/kafka/writer.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/storage/kafka/writer.go b/plugin/storage/kafka/writer.go index e82ecea735c..03e23886fd8 100644 --- a/plugin/storage/kafka/writer.go +++ b/plugin/storage/kafka/writer.go @@ -57,7 +57,9 @@ func NewSpanWriter( }() go func() { for e := range producer.Errors() { - logger.Error(e.Err.Error()) + if e != nil && e.Err != nil { + logger.Error(e.Err.Error()) + } writeMetrics.SpansWrittenFailure.Inc(1) } }()