diff --git a/CHANGELOG b/CHANGELOG index 2aed8eb322b..c00d478e43f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/config/initializers/metrics.rb b/config/initializers/metrics.rb index f6509ee43f1..4bc6acdedb9 100644 --- a/config/initializers/metrics.rb +++ b/config/initializers/metrics.rb @@ -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