1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

chore: fix metrics in redisotel

This commit is contained in:
Vladimir Mihailenco
2022-11-18 15:32:17 +02:00
parent 58e87e00e2
commit bbff4dd5dc
6 changed files with 160 additions and 32 deletions

View File

@ -430,14 +430,13 @@ func (p *ConnPool) IdleLen() int {
}
func (p *ConnPool) Stats() *Stats {
idleLen := p.IdleLen()
return &Stats{
Hits: atomic.LoadUint32(&p.stats.Hits),
Misses: atomic.LoadUint32(&p.stats.Misses),
Timeouts: atomic.LoadUint32(&p.stats.Timeouts),
TotalConns: uint32(p.Len()),
IdleConns: uint32(idleLen),
IdleConns: uint32(p.IdleLen()),
StaleConns: atomic.LoadUint32(&p.stats.StaleConns),
}
}