Don't record proto.Nil

This commit is contained in:
Vladimir Mihailenco 2020-07-09 11:00:17 +03:00
parent 1831363467
commit 8f29d08432
1 changed files with 4 additions and 1 deletions
internal

View File

@ -7,6 +7,7 @@ import (
"time" "time"
"unicode/utf8" "unicode/utf8"
"github.com/go-redis/redis/v8/internal/proto"
"github.com/go-redis/redis/v8/internal/util" "github.com/go-redis/redis/v8/internal/util"
"go.opentelemetry.io/otel/api/global" "go.opentelemetry.io/otel/api/global"
"go.opentelemetry.io/otel/api/trace" "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 { 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 return err
} }