forked from mirror/redis
Add constructors
This commit is contained in:
parent
24c92382c9
commit
ef568e261e
|
@ -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())
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue