redis/internal/instruments.go

32 lines
745 B
Go
Raw Normal View History

package internal
import (
"go.opentelemetry.io/otel/api/global"
"go.opentelemetry.io/otel/api/metric"
)
var (
// Count of write commands performed
WritesCounter metric.Int64Counter
// Count of new connections
NewConnectionsCounter metric.Int64Counter
)
func init() {
defer func() {
if r := recover(); r != nil {
Logger.Printf("Error creating meter github.com/go-redis/redis for Instruments", r)
}
}()
meter := metric.Must(global.Meter("github.com/go-redis/redis"))
WritesCounter = meter.NewInt64Counter("redis.writes",
metric.WithDescription("the number of writes initiated"),
)
NewConnectionsCounter = meter.NewInt64Counter("redis.new_connections",
metric.WithDescription("the number of connections created"),
)
}