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

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

27 lines
630 B
Ruby
Raw Permalink 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