Joey Armstrong | e8c091f | 2023-01-17 16:56:26 -0500 | [diff] [blame] | 1 | package internal |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | |
| 6 | "go.opentelemetry.io/otel/api/global" |
| 7 | "go.opentelemetry.io/otel/api/metric" |
| 8 | ) |
| 9 | |
| 10 | var ( |
| 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 | |
| 17 | func 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 | } |