PoolStats returns accumulated connection pool stats.
()
| 654 | |
| 655 | // PoolStats returns accumulated connection pool stats. |
| 656 | func (c *Ring) PoolStats() *PoolStats { |
| 657 | // note: `c.List()` return a shadow copy of `[]*ringShard`. |
| 658 | shards := c.sharding.List() |
| 659 | var acc PoolStats |
| 660 | for _, shard := range shards { |
| 661 | s := shard.Client.connPool.Stats() |
| 662 | acc.Hits += s.Hits |
| 663 | acc.Misses += s.Misses |
| 664 | acc.Timeouts += s.Timeouts |
| 665 | acc.TotalConns += s.TotalConns |
| 666 | acc.IdleConns += s.IdleConns |
| 667 | } |
| 668 | return &acc |
| 669 | } |
| 670 | |
| 671 | // Len returns the current number of shards in the ring. |
| 672 | func (c *Ring) Len() int { |