Migrate expiration policy metrics
What does this MR do and why?
This MR migrate counts.projects_with_expiration_policy_enabled(_with_older_than*)
metrics family to instrumentation class.
It resolves part of the metrics included in #339315 (closed)
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Setup (optional)
::ContainerExpirationPolicy.limit(30).update_all(enabled: true)
(::ContainerExpirationPolicy.older_than_options.keys << nil).each_with_index do |value, idx|
::ContainerExpirationPolicy.active.order(:project_id).offset(idx * 5).limit(5).update_all(older_than: value)
end
Verfication
payload = ServicePing::BuildPayload.new.execute
puts "enabled: #{payload["counts"]["projects_with_expiration_policy_enabled"]}"
puts "enabled with older_than_unset: #{payload["counts"]["projects_with_expiration_policy_enabled_with_older_than_unset"]}"
puts "enabled with older_than_set_to_7d: #{payload["counts"]["projects_with_expiration_policy_enabled_with_older_than_set_to_7d"]}"
puts "enabled with older_than_set_to_14d: #{payload["counts"]["projects_with_expiration_policy_enabled_with_older_than_set_to_14d"]}"
puts "enabled with older_than_set_to_30d: #{payload["counts"]["projects_with_expiration_policy_enabled_with_older_than_set_to_30d"]}"
puts "enabled with older_than_set_to_60d: #{payload["counts"]["projects_with_expiration_policy_enabled_with_older_than_set_to_60d"]}"
puts "enabled with older_than_set_to_90d: #{payload["counts"]["projects_with_expiration_policy_enabled_with_older_than_set_to_90d"]}"
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Mikołaj Wawrzyniak