From ea78cc7d7e09ed8a57052800c1ef6898dc3b2193 Mon Sep 17 00:00:00 2001 From: Andrew Suffield Date: Wed, 26 Aug 2020 12:24:45 +0100 Subject: [PATCH] add more trace details to dialer spans --- options.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/options.go b/options.go index 90c09450..18dcf285 100644 --- a/options.go +++ b/options.go @@ -14,6 +14,8 @@ import ( "github.com/go-redis/redis/v8/internal" "github.com/go-redis/redis/v8/internal/pool" + "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/label" ) // Limiter is the interface of a rate limiter or a circuit breaker. @@ -243,7 +245,14 @@ func newConnPool(opt *Options) *pool.ConnPool { var conn net.Conn err := internal.WithSpan(ctx, "dialer", func(ctx context.Context) error { var err error + trace.SpanFromContext(ctx).SetAttributes( + label.String("redis.network", opt.Network), + label.String("redis.addr", opt.Addr), + ) conn, err = opt.Dialer(ctx, opt.Network, opt.Addr) + if err != nil { + internal.RecordError(ctx, err) + } return err }) return conn, err