From 8f29d084329e8a30f02d7b72ecedf3a0b928d095 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Thu, 9 Jul 2020 11:00:17 +0300 Subject: [PATCH] Don't record proto.Nil --- internal/util.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/util.go b/internal/util.go index d0c00dc..4f8549e 100644 --- a/internal/util.go +++ b/internal/util.go @@ -7,6 +7,7 @@ import ( "time" "unicode/utf8" + "github.com/go-redis/redis/v8/internal/proto" "github.com/go-redis/redis/v8/internal/util" "go.opentelemetry.io/otel/api/global" "go.opentelemetry.io/otel/api/trace" @@ -147,6 +148,8 @@ func WithSpan(ctx context.Context, name string, fn func(context.Context) error) } func RecordError(ctx context.Context, err error) error { - trace.SpanFromContext(ctx).RecordError(ctx, err) + if err != proto.Nil { + trace.SpanFromContext(ctx).RecordError(ctx, err) + } return err }