| 31 | } |
| 32 | |
| 33 | func (redisHook) ProcessPipelineHook(hook redis.ProcessPipelineHook) redis.ProcessPipelineHook { |
| 34 | return func(ctx context.Context, cmds []redis.Cmder) error { |
| 35 | names := make([]string, 0, len(cmds)) |
| 36 | for _, cmd := range cmds { |
| 37 | names = append(names, fmt.Sprintf("%v", cmd.Args())) |
| 38 | } |
| 39 | fmt.Printf("pipeline starting processing: %v\n", names) |
| 40 | err := hook(ctx, cmds) |
| 41 | fmt.Printf("pipeline finished processing: %v\n", names) |
| 42 | return err |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | func Example_instrumentation() { |
| 47 | rdb := redis.NewClient(&redis.Options{ |