コード例 #1
0
ファイル: pool_test.go プロジェクト: DaleWebb/readraptor
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)
	}
}
コード例 #2
0
ファイル: stats.go プロジェクト: albert-wang/rawr-website-go
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))
	}
}