Example #1
0
func (d *poolDialer) check(message string, p *redis.Pool, dialed, open int) {
	if d.dialed != dialed {
		d.t.Errorf("%s: dialed=%d, want %d", message, d.dialed, dialed)
	}
	if d.open != open {
		d.t.Errorf("%s: open=%d, want %d", message, d.open, open)
	}
	if active := p.ActiveCount(); active != open {
		d.t.Errorf("%s: active=%d, want %d", message, active, open)
	}
}
Example #2
0
func collectStats(db *sqlx.DB, pool *redis.Pool, client *statsd.StatsdClient) {
	ticker := time.NewTicker(time.Second * 5)

	for _ = range ticker.C {
		stats := db.Stats()
		oc := stats.OpenConnections
		active := pool.ActiveCount()

		client.Gauge("dbconnections", int64(oc))
		client.Gauge("redisconnections", int64(active))
	}
}