@@ -155,6 +155,22 @@ func reportPoolStats(rdb *redis.Client, conf *config) (metric.Registration, erro
155155 return nil , err
156156 }
157157
158+ waits , err := conf .meter .Int64ObservableUpDownCounter (
159+ "db.client.connections.waits" ,
160+ metric .WithDescription ("The number of times a connection was waited for" ),
161+ )
162+ if err != nil {
163+ return nil , err
164+ }
165+
166+ waitsDuration , err := conf .meter .Int64ObservableUpDownCounter (
167+ "db.client.connections.waits_duration" ,
168+ metric .WithDescription ("The total time spent for waiting a connection in nanoseconds" ),
169+ )
170+ if err != nil {
171+ return nil , err
172+ }
173+
158174 timeouts , err := conf .meter .Int64ObservableUpDownCounter (
159175 "db.client.connections.timeouts" ,
160176 metric .WithDescription ("The number of connection timeouts that have occurred trying to obtain a connection from the pool" ),
@@ -191,6 +207,9 @@ func reportPoolStats(rdb *redis.Client, conf *config) (metric.Registration, erro
191207 o .ObserveInt64 (usage , int64 (stats .IdleConns ), metric .WithAttributeSet (idleAttrs ))
192208 o .ObserveInt64 (usage , int64 (stats .TotalConns - stats .IdleConns ), metric .WithAttributeSet (usedAttrs ))
193209
210+ o .ObserveInt64 (waits , int64 (stats .WaitCount ), metric .WithAttributeSet (poolAttrs ))
211+ o .ObserveInt64 (waitsDuration , stats .WaitDurationNs , metric .WithAttributeSet (poolAttrs ))
212+
194213 o .ObserveInt64 (timeouts , int64 (stats .Timeouts ), metric .WithAttributeSet (poolAttrs ))
195214 o .ObserveInt64 (hits , int64 (stats .Hits ), metric .WithAttributeSet (poolAttrs ))
196215 o .ObserveInt64 (misses , int64 (stats .Misses ), metric .WithAttributeSet (poolAttrs ))
0 commit comments