Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

goredis

a middleware for goredis to use opentracing

import (
	"net/http"

	"github.com/go-redis/redis"

	apmgoredis "github.com/opentracing-contrib/goredis"
)

var redisClient *redis.Client // initialized at program startup

func handleRequest(w http.ResponseWriter, req *http.Request) {
	// Wrap and bind redisClient to the request context. If the HTTP
	// server is instrumented with Elastic APM (e.g. with apmhttp),
	// Redis commands will be reported as spans within the request's
	// transaction.
	client := apmgoredis.Wrap(redisClient).WithContext(req.Context())
	...
}

Example: goredis-example

About

a middleware for go-redis/redis to use opentracing

Topics

Resources

License

Releases

No releases published

Packages

No packages published

Languages