MCPcopy
hub / github.com/redis/go-redis / DialHook

Method DialHook

extra/redisotel/tracing.go:88–105  ·  view source on GitHub ↗
(hook redis.DialHook)

Source from the content-addressed store, hash-verified

86}
87
88func (th *tracingHook) DialHook(hook redis.DialHook) redis.DialHook {
89 return func(ctx context.Context, network, addr string) (net.Conn, error) {
90
91 if th.conf.filterDial {
92 return hook(ctx, network, addr)
93 }
94
95 ctx, span := th.conf.tracer.Start(ctx, "redis.dial", th.spanOpts...)
96 defer span.End()
97
98 conn, err := hook(ctx, network, addr)
99 if err != nil {
100 recordError(span, err)
101 return nil, err
102 }
103 return conn, nil
104 }
105}
106
107func (th *tracingHook) ProcessHook(hook redis.ProcessHook) redis.ProcessHook {
108 return func(ctx context.Context, cmd redis.Cmder) error {

Callers

nothing calls this directly

Calls 3

hookStruct · 0.85
recordErrorFunction · 0.85
StartMethod · 0.65

Tested by

no test coverage detected