A fork of go-redis/extra/redisotel/v9 that follows Semantic Conventions v1.27.
go get github.com/wzy9607/goredisotel
Tracing is enabled by adding a hook:
import (
"github.com/redis/go-redis/v9"
"github.com/wzy9607/goredisotel"
)
rdb := rdb.NewClient(&rdb.Options{...})
// Enable tracing and metrics instrumentation.
if err := goredisotel.InstrumentClientWithHooks(rdb); err != nil {
panic(err)
}
// Enable tracing instrumentation only.
if err := goredisotel.InstrumentClientWithHooks(rdb, goredisotel.DisableMetrics()); err != nil {
panic(err)
}
// Enable pool statistics metrics instrumentation.
if err := goredisotel.InstrumentPoolStatsMetrics(rdb); err != nil {
panic(err)
}
See example for details.