Commit 3b071d16 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '212962-cluster-distinct_by_user-to-move-to-batch-counting-ingress' into 'master'

Clusters::Applications::Ingress move distinct_by_user batch counting

See merge request gitlab-org/gitlab!28999
parents 58a51d7b 0cad9a32
---
title: Move Clusters Application Ingress to batch counting
merge_request: 28999
author:
type: performance
...@@ -202,9 +202,9 @@ module EE ...@@ -202,9 +202,9 @@ module EE
# rubocop:disable CodeReuse/ActiveRecord # rubocop:disable CodeReuse/ActiveRecord
def usage_activity_by_stage_configure(time_period) def usage_activity_by_stage_configure(time_period)
{ {
clusters_applications_cert_managers: distinct_count(::Clusters::Applications::CertManager.where(time_period).available.joins(:cluster), 'clusters.user_id'), clusters_applications_cert_managers: clusters_user_distinct_count(::Clusters::Applications::CertManager, time_period),
clusters_applications_helm: ::Clusters::Applications::Helm.where(time_period).distinct_by_user, clusters_applications_helm: ::Clusters::Applications::Helm.where(time_period).distinct_by_user,
clusters_applications_ingress: ::Clusters::Applications::Ingress.where(time_period).distinct_by_user, clusters_applications_ingress: clusters_user_distinct_count(::Clusters::Applications::Ingress, time_period),
clusters_applications_knative: ::Clusters::Applications::Knative.where(time_period).distinct_by_user, clusters_applications_knative: ::Clusters::Applications::Knative.where(time_period).distinct_by_user,
clusters_disabled: distinct_count(::Clusters::Cluster.disabled.where(time_period), :user_id), clusters_disabled: distinct_count(::Clusters::Cluster.disabled.where(time_period), :user_id),
clusters_enabled: distinct_count(::Clusters::Cluster.enabled.where(time_period), :user_id), clusters_enabled: distinct_count(::Clusters::Cluster.enabled.where(time_period), :user_id),
...@@ -351,6 +351,9 @@ module EE ...@@ -351,6 +351,9 @@ module EE
distinct_count(::Project.service_desk_enabled.where(time_period), :creator_id, start: project_creator_id_start, finish: project_creator_id_finish) distinct_count(::Project.service_desk_enabled.where(time_period), :creator_id, start: project_creator_id_start, finish: project_creator_id_finish)
end end
def clusters_user_distinct_count(clusters, time_period)
distinct_count(clusters.where(time_period).available.joins(:cluster), 'clusters.user_id')
end
# rubocop:enable CodeReuse/ActiveRecord # rubocop:enable CodeReuse/ActiveRecord
end end
end end
......
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