File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,22 @@ func reportPoolStats(rdb *redis.Client, conf *config) error {
127
127
return err
128
128
}
129
129
130
+ hits , err := conf .meter .Int64ObservableUpDownCounter (
131
+ "db.client.connections.hits" ,
132
+ metric .WithDescription ("The number of times free connection was found in the pool" ),
133
+ )
134
+ if err != nil {
135
+ return err
136
+ }
137
+
138
+ misses , err := conf .meter .Int64ObservableUpDownCounter (
139
+ "db.client.connections.misses" ,
140
+ metric .WithDescription ("The number of times free connection was not found in the pool" ),
141
+ )
142
+ if err != nil {
143
+ return err
144
+ }
145
+
130
146
redisConf := rdb .Options ()
131
147
_ , err = conf .meter .RegisterCallback (
132
148
func (ctx context.Context , o metric.Observer ) error {
@@ -140,13 +156,17 @@ func reportPoolStats(rdb *redis.Client, conf *config) error {
140
156
o .ObserveInt64 (usage , int64 (stats .TotalConns - stats .IdleConns ), metric .WithAttributes (usedAttrs ... ))
141
157
142
158
o .ObserveInt64 (timeouts , int64 (stats .Timeouts ), metric .WithAttributes (labels ... ))
159
+ o .ObserveInt64 (hits , int64 (stats .Hits ), metric .WithAttributes (labels ... ))
160
+ o .ObserveInt64 (misses , int64 (stats .Misses ), metric .WithAttributes (labels ... ))
143
161
return nil
144
162
},
145
163
idleMax ,
146
164
idleMin ,
147
165
connsMax ,
148
166
usage ,
149
167
timeouts ,
168
+ hits ,
169
+ misses ,
150
170
)
151
171
152
172
return err
You can’t perform that action at this time.
0 commit comments