Welcome to mirror list, hosted at ThFree Co, Russian Federation.

metrics.rb « database « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5dabbc81b9c0512a2805bdd2eb1572a05075cbf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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