(rdb *redis.Client, conf *config)
| 135 | } |
| 136 | |
| 137 | func reportPoolStats(rdb *redis.Client, conf *config) (metric.Registration, error) { |
| 138 | poolAttrs, idleAttrs, usedAttrs := poolStatsAttrs(conf) |
| 139 | |
| 140 | idleMax, err := conf.meter.Int64ObservableUpDownCounter( |
| 141 | "db.client.connections.idle.max", |
| 142 | metric.WithDescription("The maximum number of idle open connections allowed"), |
| 143 | ) |
| 144 | if err != nil { |
| 145 | return nil, err |
| 146 | } |
| 147 | |
| 148 | idleMin, err := conf.meter.Int64ObservableUpDownCounter( |
| 149 | "db.client.connections.idle.min", |
| 150 | metric.WithDescription("The minimum number of idle open connections allowed"), |
| 151 | ) |
| 152 | if err != nil { |
| 153 | return nil, err |
| 154 | } |
| 155 | |
| 156 | connsMax, err := conf.meter.Int64ObservableUpDownCounter( |
| 157 | "db.client.connections.max", |
| 158 | metric.WithDescription("The maximum number of open connections allowed"), |
| 159 | ) |
| 160 | if err != nil { |
| 161 | return nil, err |
| 162 | } |
| 163 | |
| 164 | usage, err := conf.meter.Int64ObservableUpDownCounter( |
| 165 | "db.client.connections.usage", |
| 166 | metric.WithDescription("The number of connections that are currently in state described by the state attribute"), |
| 167 | ) |
| 168 | if err != nil { |
| 169 | return nil, err |
| 170 | } |
| 171 | |
| 172 | waits, err := conf.meter.Int64ObservableUpDownCounter( |
| 173 | "db.client.connections.waits", |
| 174 | metric.WithDescription("The number of times a connection was waited for"), |
| 175 | ) |
| 176 | if err != nil { |
| 177 | return nil, err |
| 178 | } |
| 179 | |
| 180 | waitsDuration, err := conf.meter.Int64ObservableUpDownCounter( |
| 181 | "db.client.connections.waits_duration", |
| 182 | metric.WithDescription("The total time spent for waiting a connection in nanoseconds"), |
| 183 | metric.WithUnit("ns"), |
| 184 | ) |
| 185 | if err != nil { |
| 186 | return nil, err |
| 187 | } |
| 188 | |
| 189 | timeouts, err := conf.meter.Int64ObservableUpDownCounter( |
| 190 | "db.client.connections.timeouts", |
| 191 | metric.WithDescription("The number of connection timeouts that have occurred trying to obtain a connection from the pool"), |
| 192 | ) |
| 193 | if err != nil { |
| 194 | return nil, err |
no test coverage detected