Track new Redis connections

Increment the counter `new_redis_connections` on each call to
`Redis::Client#connect`, if we're in a transaction.
This commit is contained in:
Sean McGivern 2016-06-14 15:49:26 +01:00
parent ab3fb00c42
commit 3582c6aedc
2 changed files with 17 additions and 0 deletions

View File

@ -22,6 +22,7 @@ v 8.9.0 (unreleased)
- Reduce number of fog gem dependencies
- Remove project notification settings associated with deleted projects
- Fix 404 page when viewing TODOs that contain milestones or labels in different projects
- Add a metric for the number of new Redis connections created by a transaction
- Redesign navigation for project pages
- Fix groups API to list only user's accessible projects
- Redesign account and email confirmation emails

View File

@ -138,4 +138,20 @@ if Gitlab::Metrics.enabled?
GC::Profiler.enable
Gitlab::Metrics::Sampler.new.start
module TrackNewRedisConnections
def connect(*args)
val = super
if current_transaction = Gitlab::Metrics::Transaction.current
current_transaction.increment(:new_redis_connections, 1)
end
val
end
end
class ::Redis::Client
prepend TrackNewRedisConnections
end
end