From ef568e261e7eda65894515bda54c09c7c397c633 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Fri, 16 Apr 2021 15:00:10 +0300 Subject: [PATCH] Add constructors --- extra/rediscensus/rediscensus.go | 6 +++++- extra/redisotel/redisotel.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) 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() {