debian-mirror-gitlab/lib/gitlab/instrumentation/rate_limiting_gates.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
556 B
Ruby
Raw Normal View History

2022-07-16 23:28:13 +05:30
# frozen_string_literal: true
module Gitlab
module Instrumentation
class RateLimitingGates
GATES = :rate_limiting_gates
class << self
def track(key)
if ::Gitlab::SafeRequestStore.active?
gates_set << key
end
end
def gates
gates_set.to_a
end
def payload
{
GATES => gates
}
end
private
def gates_set
::Gitlab::SafeRequestStore[GATES] ||= Set.new
end
end
end
end
end