Commit 6a549be4 authored by Victor Zagorodny's avatar Victor Zagorodny

Extend UsageData with preferences usage

parent 00a3ccf5
......@@ -88,6 +88,16 @@ module EE
end
# rubocop: enable CodeReuse/ActiveRecord
# Note: when adding a preference, check if it's mapped to an attribute of a User model. If so, name
# the base key part after a corresponding User model attribute, use its possible values as suffix values.
override :preferences_usage
def preferences_usage
super.merge(
preference_group_overview_details: count(::User.group_view_details),
preference_group_overview_security_dashboard: count(::User.group_view_security_dashboard)
)
end
override :system_usage_data
def system_usage_data
usage_data = super
......
......@@ -92,7 +92,10 @@ module Gitlab
todos: count(Todo),
uploads: count(Upload),
web_hooks: count(WebHook)
}.merge(services_usage).merge(approximate_counts)
}
.merge(services_usage)
.merge(approximate_counts)
.merge(preferences_usage)
}
end
# rubocop: enable CodeReuse/ActiveRecord
......@@ -161,6 +164,10 @@ module Gitlab
}
end
def preferences_usage
{}
end
def count(relation, fallback: -1)
relation.count
rescue ActiveRecord::StatementInvalid
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment