Categorygithub.com/smacker/opentracing-go-redis
modulepackage
0.0.0-20190628101507-6225d3249491
Repository: https://github.com/smacker/opentracing-go-redis.git
Documentation: pkg.go.dev

# README

opentracing go-redis

OpenTracing instrumentation for go-redis.

Install

go get -u github.com/smacker/opentracing-go-redis

Usage

Clone redis client c := otredis.WrapRedisClient(ctx, c) with a span.

Example:

var client *redis.Client

func Handler(ctx context.Context) {
    span, ctx := opentracing.StartSpanFromContext(ctx, "handler")
    defer span.Finish()

    // clone redis with proper context
    client := otredis.WrapRedisClient(ctx, client)

    // make requests to redis
    client.Get("foo")
}

Call to the Handler function would create redis span as a child of handler span.

License

MIT

# Functions

WrapRedisClient adds opentracing measurements for commands and returns cloned client.