summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-26 21:06:29 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-26 21:06:29 +0000
commit430999251558db3c64b4adfc6e2b4fb771f6cd48 (patch)
treedd8bb7eab17ab8072179b9636bde34ec67ea17f5 /lib
parente66d6781ef36e39d15b1b9bc84cc30e87969edad (diff)
downloadgitlab-ce-430999251558db3c64b4adfc6e2b4fb771f6cd48.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/auth/ip_rate_limiter.rb1
-rw-r--r--lib/gitlab/tracking.rb11
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/gitlab/auth/ip_rate_limiter.rb b/lib/gitlab/auth/ip_rate_limiter.rb
index 0b7055b3256..74d359bcd28 100644
--- a/lib/gitlab/auth/ip_rate_limiter.rb
+++ b/lib/gitlab/auth/ip_rate_limiter.rb
@@ -24,6 +24,7 @@ module Gitlab
# Allow2Ban.filter will return false if this IP has not failed too often yet
@banned = Rack::Attack::Allow2Ban.filter(ip, config) do
# If we return false here, the failure for this IP is ignored by Allow2Ban
+ # If we return true here, the count for the IP is incremented.
ip_can_be_banned?
end
end
diff --git a/lib/gitlab/tracking.rb b/lib/gitlab/tracking.rb
index b167cb098b0..34eaf45aa75 100644
--- a/lib/gitlab/tracking.rb
+++ b/lib/gitlab/tracking.rb
@@ -6,6 +6,17 @@ module Gitlab
module Tracking
SNOWPLOW_NAMESPACE = 'gl'
+ module ControllerConcern
+ extend ActiveSupport::Concern
+
+ protected
+
+ def track_event(action = action_name, **args)
+ category = args.delete(:category) || self.class.name
+ Gitlab::Tracking.event(category, action.to_s, **args)
+ end
+ end
+
class << self
def enabled?
Gitlab::CurrentSettings.snowplow_enabled?