1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

Add missing Tx instrumentation

This commit is contained in:
Vladimir Mihailenco
2019-12-29 12:06:43 +02:00
parent 6c240ffc72
commit c0fcf85f12
5 changed files with 72 additions and 12 deletions

View File

@ -56,3 +56,25 @@ func ExamplePipeline_instrumentation() {
// Output: pipeline starting processing: [ping: ping: ]
// pipeline finished processing: [ping: PONG ping: PONG]
}
func ExampleWatch_instrumentation() {
rdb := redis.NewClient(&redis.Options{
Addr: ":6379",
})
rdb.AddHook(redisHook{})
rdb.Watch(func(tx *redis.Tx) error {
tx.Ping()
tx.Ping()
return nil
}, "foo")
// Output:
// starting processing: <watch foo: >
// finished processing: <watch foo: OK>
// starting processing: <ping: >
// finished processing: <ping: PONG>
// starting processing: <ping: >
// finished processing: <ping: PONG>
// starting processing: <unwatch: >
// finished processing: <unwatch: OK>
}