debian-mirror-gitlab/lib/gitlab/database/metrics.rb

27 lines
630 B
Ruby
Raw Normal View History

2021-10-27 15:23:28 +05:30
# frozen_string_literal: true
module Gitlab
module Database
class Metrics
extend ::Gitlab::Utils::StrongMemoize
class << self
def subtransactions_increment(model_name)
subtransactions_counter.increment(model: model_name)
end
private
def subtransactions_counter
strong_memoize(:subtransactions_counter) do
name = :gitlab_active_record_subtransactions_total
comment = 'Total amount of subtransactions created by ActiveRecord'
::Gitlab::Metrics.counter(name, comment)
end
end
end
end
end
end