debian-mirror-gitlab/lib/gitlab/ci/artifacts/metrics.rb

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

47 lines
1.3 KiB
Ruby
Raw Normal View History

2021-04-17 20:07:23 +05:30
# frozen_string_literal: true
module Gitlab
module Ci
module Artifacts
class Metrics
include Gitlab::Utils::StrongMemoize
2022-08-27 11:52:29 +05:30
def self.build_completed_report_type_counter(report_type)
name = "artifact_report_#{report_type}_builds_completed_total".to_sym
comment = "Number of completed builds with #{report_type} report artifacts"
::Gitlab::Metrics.counter(name, comment)
end
2021-12-11 22:18:48 +05:30
def increment_destroyed_artifacts_count(size)
2021-04-17 20:07:23 +05:30
destroyed_artifacts_counter.increment({}, size.to_i)
end
2021-12-11 22:18:48 +05:30
def increment_destroyed_artifacts_bytes(bytes)
destroyed_artifacts_bytes_counter.increment({}, bytes)
end
2021-04-17 20:07:23 +05:30
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
2021-12-11 22:18:48 +05:30
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
2021-04-17 20:07:23 +05:30
end
end
end
end