diff --git a/config/feature_flags/development/add_timing_to_certain_cache_actions.yml b/config/feature_flags/development/add_timing_to_certain_cache_actions.yml deleted file mode 100644 index c03e49dae8d..00000000000 --- a/config/feature_flags/development/add_timing_to_certain_cache_actions.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: add_timing_to_certain_cache_actions -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/94966 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/371657 -milestone: '15.4' -type: development -group: group::code review -default_enabled: false diff --git a/db/post_migrate/20220920122121_schedule_index_removal_for_ci_builds_metadata.rb b/db/post_migrate/20220920122121_schedule_index_removal_for_ci_builds_metadata.rb new file mode 100644 index 00000000000..57475a08c93 --- /dev/null +++ b/db/post_migrate/20220920122121_schedule_index_removal_for_ci_builds_metadata.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class ScheduleIndexRemovalForCiBuildsMetadata < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + TABLE_NAME = :ci_builds_metadata + INDEX_NAME = :index_ci_builds_metadata_on_build_id + + def up + prepare_async_index_removal(TABLE_NAME, :build_id, name: INDEX_NAME) + end + + def down + unprepare_async_index(TABLE_NAME, :build_id, name: INDEX_NAME) + end +end diff --git a/db/schema_migrations/20220920122121 b/db/schema_migrations/20220920122121 new file mode 100644 index 00000000000..7da41e83a11 --- /dev/null +++ b/db/schema_migrations/20220920122121 @@ -0,0 +1 @@ +fb6b88494168ef86863f41570a2bad1141d6c6e2305522bf622413702e3b3493 \ No newline at end of file diff --git a/lib/gitlab/cache/helpers.rb b/lib/gitlab/cache/helpers.rb index 48b6ca59367..024fa48c066 100644 --- a/lib/gitlab/cache/helpers.rb +++ b/lib/gitlab/cache/helpers.rb @@ -126,7 +126,6 @@ module Gitlab end def increment_cache_metric(render_type:, total_count:, miss_count:) - return unless Feature.enabled?(:add_timing_to_certain_cache_actions) return unless caller_id metric_name = :cached_object_operations_total @@ -146,17 +145,13 @@ module Gitlab end def time_action(render_type:, &block) - if Feature.enabled?(:add_timing_to_certain_cache_actions) - real_start = Gitlab::Metrics::System.monotonic_time + real_start = Gitlab::Metrics::System.monotonic_time - presented_object = yield + presented_object = yield - real_duration_histogram(render_type).observe({}, Gitlab::Metrics::System.monotonic_time - real_start) + real_duration_histogram(render_type).observe({}, Gitlab::Metrics::System.monotonic_time - real_start) - presented_object - else - yield - end + presented_object end def real_duration_histogram(render_type) diff --git a/spec/support/shared_examples/lib/cache_helpers_shared_examples.rb b/spec/support/shared_examples/lib/cache_helpers_shared_examples.rb index 82a9e8130f7..2e00abe2f8e 100644 --- a/spec/support/shared_examples/lib/cache_helpers_shared_examples.rb +++ b/spec/support/shared_examples/lib/cache_helpers_shared_examples.rb @@ -54,31 +54,6 @@ RSpec.shared_examples_for 'object cache helper' do allow(Gitlab::ApplicationContext).to receive(:current_context_attribute).with(:caller_id).and_return(caller_id) end - context 'when feature flag is off' do - before do - stub_feature_flags(add_timing_to_certain_cache_actions: false) - end - - it 'does not call increment' do - expect(transaction).not_to receive(:increment).with(:cached_object_operations_total, any_args) - - subject - end - - it 'does not call histogram' do - expect(Gitlab::Metrics).not_to receive(:histogram) - - subject - end - - it "is valid JSON" do - parsed = Gitlab::Json.parse(subject.to_s) - - expect(parsed).to be_a(Hash) - expect(parsed["id"]).to eq(presentable.id) - end - end - it 'increments the counter' do expect(transaction) .to receive(:increment) @@ -157,34 +132,6 @@ RSpec.shared_examples_for 'collection cache helper' do allow(Gitlab::ApplicationContext).to receive(:current_context_attribute).with(:caller_id).and_return(caller_id) end - context 'when feature flag is off' do - before do - stub_feature_flags(add_timing_to_certain_cache_actions: false) - end - - it 'does not call increment' do - expect(transaction).not_to receive(:increment).with(:cached_object_operations_total, any_args) - - subject - end - - it 'does not call histogram' do - expect(Gitlab::Metrics).not_to receive(:histogram) - - subject - end - - it "is valid JSON" do - parsed = Gitlab::Json.parse(subject.to_s) - - expect(parsed).to be_an(Array) - - presentable.each_with_index do |item, i| - expect(parsed[i]["id"]).to eq(item.id) - end - end - end - context 'when presentable has a group by clause' do let(:presentable) { MergeRequest.group(:id) }