Commit 2b570f04 authored by Max Woolf's avatar Max Woolf

Merge branch '329178-remove-vsa-deployment-frequency-ff' into 'master'

Remove the DORA DF feature flag in VSA

See merge request gitlab-org/gitlab!73719
parents 2ea6c056 8d83b744
---
name: dora_deployment_frequency_in_vsa
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60367
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/329178
milestone: '13.12'
type: development
group: group::optimize
default_enabled: true
......@@ -19,23 +19,8 @@ module Gitlab
private
def deployments_count
@deployments_count ||= if Feature.enabled?(:dora_deployment_frequency_in_vsa, default_enabled: :yaml)
deployment_count_via_dora_api
else
deployment_count_via_finder
@deployments_count ||= deployment_count_via_dora_api
end
end
# rubocop: disable CodeReuse/ActiveRecord
def deployment_count_via_finder
deployments = DeploymentsFinder
.new(group: group, finished_after: options[:from], finished_before: options[:to], status: :success, order_by: :finished_at)
.execute
deployments = deployments.where(project_id: options[:projects]) if options[:projects].present?
deployments.count
end
# rubocop: enable CodeReuse/ActiveRecord
def deployment_count_via_dora_api
result = Dora::AggregateMetricsService.new(
......
......@@ -132,11 +132,10 @@ RSpec.describe Gitlab::Analytics::CycleAnalytics::Summary::Group::StageSummary d
environment = project.environments.production.first || create(:environment, :production, project: project)
create(:deployment, :success, args.merge(environment: environment))
# this is needed for the dora_deployment_frequency_in_vsa feature flag so we have aggregated data
# this is needed for the DORA API so we have aggregated data
::Dora::DailyMetrics::RefreshWorker.new.perform(environment.id, Time.current.to_date.to_s)
end
shared_examples 'VSA deployment related metrics' do
describe "#deploys" do
let(:current_time) { Time.current }
let(:one_day_ago) { current_time - 1.day }
......@@ -262,25 +261,4 @@ RSpec.describe Gitlab::Analytics::CycleAnalytics::Summary::Group::StageSummary d
end
end
end
end
context 'when dora_deployment_frequency_in_vsa feature flag is enabled' do
before do
stub_feature_flags(dora_deployment_frequency_in_vsa: true)
expect(Dora::AggregateMetricsService).to receive(:new).and_call_original
end
it_behaves_like 'VSA deployment related metrics'
end
context 'when dora_deployment_frequency_in_vsa feature flag is disabled' do
before do
stub_feature_flags(dora_deployment_frequency_in_vsa: false)
expect(Dora::AggregateMetricsService).not_to receive(:new)
end
it_behaves_like 'VSA deployment related metrics'
end
end
......@@ -6,7 +6,7 @@ shared_examples 'deployment metrics examples' do
environment = project.environments.production.first || create(:environment, :production, project: project)
create(:deployment, :success, args.merge(environment: environment))
# this is needed for the dora_deployment_frequency_in_vsa feature flag so we have aggregated data
# this is needed for the DORA API so we have aggregated data
::Dora::DailyMetrics::RefreshWorker.new.perform(environment.id, Time.current.to_date.to_s) if Gitlab.ee?
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