debian-mirror-gitlab/lib/gitlab/metrics/loose_foreign_keys_slis.rb

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

47 lines
1.2 KiB
Ruby
Raw Normal View History

2023-01-13 00:05:48 +05:30
# frozen_string_literal: true
module Gitlab
module Metrics
module LooseForeignKeysSlis
class << self
def initialize_slis!
Gitlab::Metrics::Sli::Apdex.initialize_sli(:loose_foreign_key_clean_ups, possible_labels)
Gitlab::Metrics::Sli::ErrorRate.initialize_sli(:loose_foreign_key_clean_ups, possible_labels)
end
def record_apdex(success:, db_config_name:)
Gitlab::Metrics::Sli::Apdex[:loose_foreign_key_clean_ups].increment(
labels: labels(db_config_name),
success: success
)
end
def record_error_rate(error:, db_config_name:)
Gitlab::Metrics::Sli::ErrorRate[:loose_foreign_key_clean_ups].increment(
labels: labels(db_config_name),
error: error
)
end
private
def possible_labels
::Gitlab::Database.db_config_names.map do |db_config_name|
{
db_config_name: db_config_name,
feature_category: :database
}
end
end
def labels(db_config_name)
{
db_config_name: db_config_name,
feature_category: :database
}
end
end
end
end
end