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

metrics.rb « artifacts « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 03459c4bf366cdaec5d2abc2baa75bb6412053b7 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

module Gitlab
  module Ci
    module Artifacts
      class Metrics
        include Gitlab::Utils::StrongMemoize

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

        def increment_destroyed_artifacts_bytes(bytes)
          destroyed_artifacts_bytes_counter.increment({}, bytes)
        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

        def destroyed_artifacts_bytes_counter
          strong_memoize(:destroyed_artifacts_bytes_counter) do
            name = :destroyed_job_artifacts_bytes_total
            comment = 'Counter of bytes of destroyed expired job artifacts'

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