debian-mirror-gitlab/lib/gitlab/instrumentation/rate_limiting_gates.rb
2022-07-16 19:58:13 +02:00

33 lines
556 B
Ruby

# 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