Replies: 2 comments 16 replies
-
Sounds good to me 👍 I believe this new hook should be optional: type ConnectEvent struct {
Err error
}
type ConnectHook interface {
BeforeConnect(ctx context.Context) context.Context
AfterConnect(ctx context.Context, event ConnectEvent)
}
type fullHook interface {
Hook
ConnectHook
}
type hooks struct {
hooks []fullHook
} Then in Does that make sense? |
Beta Was this translation helpful? Give feedback.
7 replies
-
It sounds good, but I can hardly imagine what benefits this hook can bring? Why should we add it? |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The idea is extending the current Hook interface [1] for adding two new available functions, for example
BeforeConnect
andAfterConnect
, that would be called before a new connection is asked and before.These two new hooks could be used for extending observability that the client side, providing a reliable metric on the cost of creating new connections in terms of latency.
Connection errors could be also provided as a parameter of the
AfterConnect
function.I could take care of making the proper PR with the implementation.
[1] https://github.com/go-redis/redis/blob/6e4eb2e3acad9575fb1e2c8690a3c1decf2e59e5/redis.go#L24
Beta Was this translation helpful? Give feedback.
All reactions