Documentation ¶
Overview ¶
Example ¶
// Important note: Instaredis v2 needs go-redis major version v9 and is not backward compatible with older versions of go-redis. // Initialize Instana sensor sensor := instana.NewSensor("redis-client") ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() rdb := redis.NewClient(&redis.Options{ Addr: "localhost:6382", }) // Use instaredis.WrapClient() after the Redis client instance is created in order to instrument the client. // The same instaredis.WrapClient() can be used when creating a Redis client with redis.NewFailoverClient. // When creating an instance of Redis to communicate with a cluster, instaredis.WrapClusterClient() should be used // instead. These cases apply when a client is being created via redis.NewClusterClient() or // redis.NewFailoverClusterClient() instaredis.WrapClient(rdb, sensor) // Use the API normally. rdb.Do(ctx, "incr", "counter") rdb.Get(ctx, "counter").Bytes() pipe := rdb.Pipeline() pipe.Set(ctx, "name", "Instana", time.Minute) pipe.Incr(ctx, "some_counter") pipe.Exec(ctx) txPipe := rdb.TxPipeline() txPipe.Set(ctx, "email", "info@instana.com", time.Minute) txPipe.Incr(ctx, "some_counter") txPipe.Exec(ctx)
Output:
Index ¶
Examples ¶
Constants ¶
View Source
const Version = "2.15.0"
Version is the instrumentation module semantic version
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InstanaRedisClient ¶
type InstanaRedisClient interface { AddHook(hook redis.Hook) Options() *redis.Options }
func WrapClient ¶
func WrapClient(client InstanaRedisClient, sensor instana.TracerLogger) InstanaRedisClient
WrapClient wraps the Redis client instance in order to add the instrumentation
type InstanaRedisClusterClient ¶
type InstanaRedisClusterClient interface { AddHook(hook redis.Hook) Options() *redis.ClusterOptions }
func WrapClusterClient ¶
func WrapClusterClient(clusterClient InstanaRedisClusterClient, sensor instana.TracerLogger) InstanaRedisClusterClient
WrapClusterClient wraps the Redis client instance in order to add the instrumentation
Click to show internal directories.
Click to hide internal directories.