summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/artifacts/metrics.rb
blob: 656f4d2cc13e235fee3d52d2d4cea80a469874fb (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 Ci
    module Artifacts
      class Metrics
        include Gitlab::Utils::StrongMemoize

        def increment_destroyed_artifacts(size)
          destroyed_artifacts_counter.increment({}, size.to_i)
        end

        private

        def destroyed_artifacts_counter
          strong_memoize(:destroyed_artifacts_counter) do
            name = :destroyed_job_artifacts_count_total
            comment = 'Counter of destroyed expired job artifacts'

            ::Gitlab::Metrics.counter(name, comment)
          end
        end
      end
    end
  end
end