cleanup trace spans

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2024-07-05 23:11:12 +03:00
parent b263e14032
commit 686bc22eac

View File

@ -18,14 +18,12 @@ func setTracing(rdb redis.UniversalClient, tr tracer.Tracer, opts ...tracer.Span
connString := formatDBConnString(opt.Network, opt.Addr) connString := formatDBConnString(opt.Network, opt.Addr)
rdb.AddHook(newTracingHook(connString, tr)) rdb.AddHook(newTracingHook(connString, tr))
case *redis.ClusterClient: case *redis.ClusterClient:
rdb.AddHook(newTracingHook("", tr, opts...))
rdb.OnNewNode(func(rdb *redis.Client) { rdb.OnNewNode(func(rdb *redis.Client) {
opt := rdb.Options() opt := rdb.Options()
connString := formatDBConnString(opt.Network, opt.Addr) connString := formatDBConnString(opt.Network, opt.Addr)
rdb.AddHook(newTracingHook(connString, tr)) rdb.AddHook(newTracingHook(connString, tr))
}) })
case *redis.Ring: case *redis.Ring:
rdb.AddHook(newTracingHook("", tr, opts...))
rdb.OnNewNode(func(rdb *redis.Client) { rdb.OnNewNode(func(rdb *redis.Client) {
opt := rdb.Options() opt := rdb.Options()
connString := formatDBConnString(opt.Network, opt.Addr) connString := formatDBConnString(opt.Network, opt.Addr)