blob: e837526d8946d924dab05b151ff7a2d0b7c0943f [file] [log] [blame]
serkant.uluderyae5afeff2021-02-23 18:00:23 +03001package internal
2
3import (
4 "context"
5
6 "go.opentelemetry.io/otel/api/global"
7 "go.opentelemetry.io/otel/api/metric"
8)
9
10var (
11 // WritesCounter is a count of write commands performed.
12 WritesCounter metric.Int64Counter
13 // NewConnectionsCounter is a count of new connections.
14 NewConnectionsCounter metric.Int64Counter
15)
16
17func init() {
18 defer func() {
19 if r := recover(); r != nil {
20 Logger.Printf(context.Background(), "Error creating meter github.com/go-redis/redis for Instruments", r)
21 }
22 }()
23
24 meter := metric.Must(global.Meter("github.com/go-redis/redis"))
25
26 WritesCounter = meter.NewInt64Counter("redis.writes",
27 metric.WithDescription("the number of writes initiated"),
28 )
29
30 NewConnectionsCounter = meter.NewInt64Counter("redis.new_connections",
31 metric.WithDescription("the number of connections created"),
32 )
33}