You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: extract dialer to DefaultDialer to allow wrapping
Allowing the default dialing function to be wrapped allows for library
users to let the library continue to own the logic for dialing and let
users wrap the function for more observability.
My use case is to override `Options.Dialer` and add Jaeger tracing to
gain insight into the cost of new connections on a latency sensitive API.
```go
defDialer := redis.DefaultDialer(opts)
opts.Dialer = func(ctx context.Context, network, addr string) (net.Conn, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "cache-repo-redis: new redis connection")
defer span.Finish()
return defDialer(ctx, network, addr)
}
```
Without this, I end up needing to copy-paste the code from the internal
code, which is less-than-ideal since I don't want to own the maintenance
of this logic.
0 commit comments