From 356be3e349b5ea672394b9c1c893a567a6e793d6 Mon Sep 17 00:00:00 2001
From: Adam Hegyi <ahegyi@gitlab.com>
Date: Tue, 9 Feb 2021 10:51:33 +0100
Subject: [PATCH] Enable optimized merged at count FF by default

This change enables the
`optimized_merge_request_count_with_merged_at_filter` feature flag by
default.
---
 app/graphql/resolvers/project_merge_requests_resolver.rb     | 2 +-
 .../optimized_merge_request_count_with_merged_at_filter.yml  | 2 +-
 ...ptimized_merge_request_count_with_merged_at_filter-ff.yml | 5 +++++
 3 files changed, 7 insertions(+), 2 deletions(-)
 create mode 100644 ee/changelogs/unreleased/299347-enable-optimized_merge_request_count_with_merged_at_filter-ff.yml

diff --git a/app/graphql/resolvers/project_merge_requests_resolver.rb b/app/graphql/resolvers/project_merge_requests_resolver.rb
index 934f07f7d9f..9628a6dfd7a 100644
--- a/app/graphql/resolvers/project_merge_requests_resolver.rb
+++ b/app/graphql/resolvers/project_merge_requests_resolver.rb
@@ -10,7 +10,7 @@ module Resolvers
     def resolve(**args)
       scope = super
 
-      if only_count_is_selected_with_merged_at_filter?(args) && Feature.enabled?(:optimized_merge_request_count_with_merged_at_filter)
+      if only_count_is_selected_with_merged_at_filter?(args) && Feature.enabled?(:optimized_merge_request_count_with_merged_at_filter, default_enabled: :yaml)
         MergeRequest::MetricsFinder
           .new(current_user, args.merge(target_project: project))
           .execute
diff --git a/config/feature_flags/development/optimized_merge_request_count_with_merged_at_filter.yml b/config/feature_flags/development/optimized_merge_request_count_with_merged_at_filter.yml
index f27e14aab6c..a7a458e3d29 100644
--- a/config/feature_flags/development/optimized_merge_request_count_with_merged_at_filter.yml
+++ b/config/feature_flags/development/optimized_merge_request_count_with_merged_at_filter.yml
@@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/299347
 milestone: '13.9'
 type: development
 group: group::optimize
-default_enabled: false
+default_enabled: true
diff --git a/ee/changelogs/unreleased/299347-enable-optimized_merge_request_count_with_merged_at_filter-ff.yml b/ee/changelogs/unreleased/299347-enable-optimized_merge_request_count_with_merged_at_filter-ff.yml
new file mode 100644
index 00000000000..dc9605f429c
--- /dev/null
+++ b/ee/changelogs/unreleased/299347-enable-optimized_merge_request_count_with_merged_at_filter-ff.yml
@@ -0,0 +1,5 @@
+---
+title: Improve the performance of the Merge Request Analytics chart
+merge_request: 53704
+author:
+type: performance
-- 
2.30.9