Commit db42b6d6 authored by Alex Buijs's avatar Alex Buijs Committed by Heinrich Lee Yu

Optimize projects_with_tracing_enabled query

By using batch counting
parent ae677b83
......@@ -2,6 +2,7 @@
class PrometheusAlert < ApplicationRecord
include Sortable
include UsageStatistics
OPERATORS_MAP = {
lt: "<",
......
......@@ -155,7 +155,7 @@ module EE
projects_mirrored_with_pipelines_enabled: count(::Project.mirrored_with_enabled_pipelines),
projects_reporting_ci_cd_back_to_github: count(::GithubService.without_defaults.active, batch: false),
projects_with_packages: count(::Packages::Package.select('distinct project_id'), batch: false),
projects_with_prometheus_alerts: count(PrometheusAlert.distinct_projects, batch: false),
projects_with_prometheus_alerts: distinct_count(PrometheusAlert, :project_id),
projects_with_tracing_enabled: count(ProjectTracingSetting),
template_repositories: count(::Project.with_repos_templates, batch: false) + count(::Project.with_groups_level_repos_templates, batch: false)
},
......
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