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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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