Add support for cluster client in go-redis client tracing library.
The official go-redis client exposes a ClusterClient which is exposed via NewClusterClient. However, this tracing library only exposes the UniversalClient:
https://github.com/DataDog/dd-trace-go/blob/076462ab8f4e82da892f10145568973d7c0eb638/contrib/redis/go-redis.v9/redis.go#L44
This is problematic, as the implementation of the UniversalClient is entirely dependent on the length of addresses sent under the Addrs key of UniversalClient:
https://github.com/redis/go-redis/blob/e63669e1706936ac794277340c51a51c5facca70/universal.go#L243-L250
However, when using AWS ElastiCache for Redis, their implementation only exposes a single "configuration endpoint":
Once your cluster is “available,” it is ready for use. You can connect to the cluster using the Configuration Endpoint listed in the AWS Management Console.
This single address is used to connect into the cluster. Therefore, the go-redis UniversalClient will assume single-node mode, and fail to connect to the cluster. Therefore, when using AWS ElastiCache for Redis and go-redis, the ClusterClient must be manually specified.
Therefore, this request is to expose ClusterClient in this tracing pacakge.
@DataDog/apm-idm-go For your consideration.
Hello @sfc-gh-jlai
The redis contrib package also exposes a WrapClient function you can use with your redis.ClusterClient:
clusterClient := redis.NewClusterClient(&redis.ClusterOptions{Addrs: []string{":7000", ":7001", ":7002", ":7003", ":7004", ":7005"}})
redistrace.WrapClient(clusterClient)
Please let me know if this solves your issue.