package storage import "database/sql" func (s *Store) PoolStats() (own, attached sql.DBStats) { own = s.sql.Stats() s.attachMu.Lock() defer s.attachMu.Unlock() for _, a := range s.attached { for _, pool := range a.pools { st := pool.Stats() attached.MaxOpenConnections += st.MaxOpenConnections attached.OpenConnections += st.OpenConnections attached.InUse += st.InUse attached.Idle += st.Idle attached.WaitCount += st.WaitCount attached.WaitDuration += st.WaitDuration attached.MaxIdleClosed += st.MaxIdleClosed attached.MaxIdleTimeClosed += st.MaxIdleTimeClosed attached.MaxLifetimeClosed += st.MaxLifetimeClosed } } return own, attached }