Skip to content

Commit ef568e2

Browse files
committed
Add constructors
1 parent 24c9238 commit ef568e2

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

extra/rediscensus/rediscensus.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import (
1010

1111
type TracingHook struct{}
1212

13-
var _ redis.Hook = TracingHook{}
13+
var _ redis.Hook = (*TracingHook)(nil)
14+
15+
func NewTracingHook() *TracingHook {
16+
return new(TracingHook)
17+
}
1418

1519
func (TracingHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error) {
1620
ctx, span := trace.StartSpan(ctx, cmd.FullName())

extra/redisotel/redisotel.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ var tracer = otel.Tracer("github.com/go-redis/redis")
1515

1616
type TracingHook struct{}
1717

18-
var _ redis.Hook = TracingHook{}
18+
var _ redis.Hook = (*TracingHook)(nil)
19+
20+
func NewTracingHook() *TracingHook {
21+
return new(TracingHook)
22+
}
1923

2024
func (TracingHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error) {
2125
if !trace.SpanFromContext(ctx).IsRecording() {

0 commit comments

Comments
 (0)