diff --git a/internal/util.go b/internal/util.go index 7cd10f0e..f2ae9df5 100644 --- a/internal/util.go +++ b/internal/util.go @@ -2,14 +2,11 @@ package internal import ( "context" - "reflect" "time" "github.com/go-redis/redis/v8/internal/util" - "go.opentelemetry.io/otel/api/core" "go.opentelemetry.io/otel/api/global" "go.opentelemetry.io/otel/api/trace" - "google.golang.org/grpc/codes" ) func Sleep(ctx context.Context, dur time.Duration) error { @@ -62,26 +59,13 @@ func Unwrap(err error) error { return u.Unwrap() } -var ( - logTypeKey = core.Key("log.type") - logMessageKey = core.Key("log.message") -) - func WithSpan(ctx context.Context, name string, fn func(context.Context) error) error { if !trace.SpanFromContext(ctx).IsRecording() { return fn(ctx) } - ctx, span := global.TraceProvider().Tracer("go-redis").Start(ctx, name) + ctx, span := global.Tracer("go-redis").Start(ctx, name) defer span.End() - if err := fn(ctx); err != nil { - span.SetStatus(codes.Internal, err.Error()) - span.AddEvent(ctx, "error", - logTypeKey.String(reflect.TypeOf(err).String()), - logMessageKey.String(err.Error()), - ) - return err - } - return nil + return fn(ctx) }