From 3e4ae80c124cf7e6e9d015f827cd2cc1c332088b Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Wed, 12 Oct 2022 17:18:55 +0300 Subject: [PATCH] chore: improve instrumentation example --- example_instrumentation_test.go | 7 ++++++- extra/redisotel/README.md | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/example_instrumentation_test.go b/example_instrumentation_test.go index 9e8179a..e03956e 100644 --- a/example_instrumentation_test.go +++ b/example_instrumentation_test.go @@ -14,7 +14,10 @@ var _ redis.Hook = redisHook{} func (redisHook) DialHook(hook redis.DialHook) redis.DialHook { return func(ctx context.Context, network, addr string) (net.Conn, error) { - return hook(ctx, network, addr) + fmt.Printf("dialing %s %s\n", network, addr) + conn, err := hook(ctx, network, addr) + fmt.Printf("finished dialing %s %s\n", network, addr) + return conn, err } } @@ -44,6 +47,8 @@ func Example_instrumentation() { rdb.Ping(ctx) // Output: starting processing: + // dialing tcp :6379 + // finished dialing tcp :6379 // finished processing: } diff --git a/extra/redisotel/README.md b/extra/redisotel/README.md index 66c33c9..d9c2e0d 100644 --- a/extra/redisotel/README.md +++ b/extra/redisotel/README.md @@ -21,4 +21,6 @@ rdb := rdb.NewClient(&rdb.Options{...}) rdb.AddHook(redisotel.NewTracingHook()) ``` -See [example](example) and [documentation](https://redis.uptrace.dev/tracing/) for more details. +See [example](example) and +[Monitoring Go Redis Performance and Errors](https://redis.uptrace.dev/guide/go-redis-monitoring.html) +for details.