otredis

package module
v0.0.0-...-6225d32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2019 License: MIT Imports: 5 Imported by: 1

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapRedisClient

func WrapRedisClient(ctx context.Context, client *redis.Client) *redis.Client

WrapRedisClient adds opentracing measurements for commands and returns cloned client

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL