diff --git a/extra/rediscensus/rediscensus.go b/extra/rediscensus/rediscensus.go index c5641fb..1ea6a57 100644 --- a/extra/rediscensus/rediscensus.go +++ b/extra/rediscensus/rediscensus.go @@ -10,7 +10,11 @@ import ( type TracingHook struct{} -var _ redis.Hook = TracingHook{} +var _ redis.Hook = (*TracingHook)(nil) + +func NewTracingHook() *TracingHook { + return new(TracingHook) +} func (TracingHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error) { ctx, span := trace.StartSpan(ctx, cmd.FullName()) diff --git a/extra/redisotel/redisotel.go b/extra/redisotel/redisotel.go index 1ac4c29..3da6113 100644 --- a/extra/redisotel/redisotel.go +++ b/extra/redisotel/redisotel.go @@ -15,7 +15,11 @@ var tracer = otel.Tracer("github.com/go-redis/redis") type TracingHook struct{} -var _ redis.Hook = TracingHook{} +var _ redis.Hook = (*TracingHook)(nil) + +func NewTracingHook() *TracingHook { + return new(TracingHook) +} func (TracingHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error) { if !trace.SpanFromContext(ctx).IsRecording() {