1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

feat: add OpenTelemetry metrics instrumentation

This commit is contained in:
Vladimir Mihailenco
2022-10-11 15:37:34 +03:00
parent 41a533cb7b
commit 0dff3d1461
25 changed files with 1152 additions and 737 deletions

View File

@ -14,18 +14,22 @@ import (
"github.com/go-redis/redis/v9"
)
type redisHookError struct {
redis.Hook
}
type redisHookError struct{}
var _ redis.Hook = redisHookError{}
func (redisHookError) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error) {
return ctx, nil
func (redisHookError) DialHook(hook redis.DialHook) redis.DialHook {
return hook
}
func (redisHookError) AfterProcess(ctx context.Context, cmd redis.Cmder) error {
return errors.New("hook error")
func (redisHookError) ProcessHook(hook redis.ProcessHook) redis.ProcessHook {
return func(ctx context.Context, cmd redis.Cmder) error {
return errors.New("hook error")
}
}
func (redisHookError) ProcessPipelineHook(hook redis.ProcessPipelineHook) redis.ProcessPipelineHook {
return hook
}
func TestHookError(t *testing.T) {