diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-07-20 15:06:11 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-07-20 15:06:11 +0200 |
commit | 33e11345e086678fce7591bcd1d465f879d838e7 (patch) | |
tree | d3faea3c4bead6c5080876ccb6c39e42683ef84d /lib | |
parent | ac4b954c5fabbfa98fb72d88526a30713a20af5d (diff) | |
download | gitlab-ce-33e11345e086678fce7591bcd1d465f879d838e7.tar.gz |
Add custom expectations for authentication activity metrics
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/auth/activity.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/gitlab/auth/activity.rb b/lib/gitlab/auth/activity.rb index b8a0979ac35..375583c1aec 100644 --- a/lib/gitlab/auth/activity.rb +++ b/lib/gitlab/auth/activity.rb @@ -47,8 +47,14 @@ module Gitlab self.class.user_signed_out_counter.increment end - COUNTERS.each_pair do |metric, description| - define_singleton_method("#{metric}_counter") do + def self.each_counter + COUNTERS.each_pair do |metric, description| + yield "#{metric}_counter", metric, description + end + end + + each_counter do |counter, metric, description| + define_singleton_method(counter) do strong_memoize(metric) do Gitlab::Metrics.counter("gitlab_auth_#{metric}_total".to_sym, description) end |