A fork of go-redis/extra/redisotel/v9 that follows Semantic Conventions v1.38.
go get github.com/wzy9607/goredisotelTracing is enabled by adding a hook:
package main
import (
redis "github.com/redis/go-redis/v9"
"github.com/wzy9607/goredisotel"
)
func main() {
rdb := redis.NewClient(&redis.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)
}
}We support some of the standard metrics, and provide some custom metrics as well. Some standard Connection pool metrics might be slightly different compared to the Semantic Conventions due to the way go-redis exposes them. The custom metrics may be changed without semconv upgrade, so please use them with caution.
The details of the metrics are documented below:
| Name | Instrument Type | Unit (UCUM) |
|---|---|---|
db.client.operation.duration |
Histogram | s |
Standard metrics:
| Name | Instrument Type | Unit (UCUM) | Difference |
|---|---|---|---|
db.client.connection.count |
UpDownCounter | {connection} |
Observed as a ObservableUpDownCounter |
db.client.connection.idle.max |
UpDownCounter | {connection} |
Observed as a ObservableUpDownCounter |
db.client.connection.idle.min |
UpDownCounter | {connection} |
Observed as a ObservableUpDownCounter |
db.client.connection.max |
UpDownCounter | {connection} |
Observed as a ObservableUpDownCounter |
db.client.connection.timeouts |
Counter | {timeout} |
Observed as a ObservableCounter |
db.client.connection.create_time |
Histogram | s |
|
db.client.connection.use_time |
Histogram | s |
Custom metrics:
| Name | Instrument Type | Unit (UCUM) | Description |
|---|---|---|---|
db.client.connection.redis.hits |
Counter (Observable) | {hit} |
The number of times free connections was found in the pool |
db.client.connection.redis.misses |
Counter (Observable) | {miss} |
The number of times free connections was NOT found in the pool |
db.client.connection.waits |
Counter (Observable) | {wait} |
The number of times it waited to obtain open connections from the pool |
db.client.connection.wait_duration |
Counter (Observable) | s |
The total time it took to obtain open connections from the pool |
The following metrics are not supported yet:
db.client.connection.pending_requestsdb.client.connection.wait_time