diff --git a/app/models/project_feature_usage.rb b/app/models/project_feature_usage.rb index dba81a6cb60c230a4766ecd7bd8cd695a4064b86..5e47ec6310d40a3a17cd20da2708721ae0ec0d5d 100644 --- a/app/models/project_feature_usage.rb +++ b/app/models/project_feature_usage.rb @@ -19,19 +19,6 @@ def jira_dvcs_integration_field(cloud: true) end end - def log_jira_dvcs_integration_usage(cloud: true) - ::Gitlab::Database::LoadBalancing::Session.without_sticky_writes do - integration_field = self.class.jira_dvcs_integration_field(cloud: cloud) - - # The feature usage is used only once later to query the feature usage in a - # long date range. Therefore, we just need to update the timestamp once per - # day - break if persisted? && updated_today?(integration_field) - - persist_jira_dvcs_usage(integration_field) - end - end - private def updated_today?(integration_field) diff --git a/config/metrics/counts_all/20210216180232_projects_jira_dvcs_cloud_active.yml b/config/metrics/counts_all/20210216180232_projects_jira_dvcs_cloud_active.yml index 5bf8e1d6e7820b86da26af027518c9332cb22dca..c9c85bca41513077dfb93eff72675e637d2a021a 100644 --- a/config/metrics/counts_all/20210216180232_projects_jira_dvcs_cloud_active.yml +++ b/config/metrics/counts_all/20210216180232_projects_jira_dvcs_cloud_active.yml @@ -6,7 +6,7 @@ product_section: dev product_stage: manage product_group: integrations value_type: number -status: active +status: removed time_frame: all data_source: database instrumentation_class: CountProjectsWithJiraDvcsIntegrationMetric @@ -21,3 +21,5 @@ tier: - ultimate performance_indicator_type: [] milestone: "<13.9" +removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/135755 +milestone_removed: "<16.6" diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/count_projects_with_jira_dvcs_integration_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/count_projects_with_jira_dvcs_integration_metric_spec.rb deleted file mode 100644 index a2d86fc50444202ae7d9cd844af0a96bd1c1a6d5..0000000000000000000000000000000000000000 --- a/spec/lib/gitlab/usage/metrics/instrumentations/count_projects_with_jira_dvcs_integration_metric_spec.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Gitlab::Usage::Metrics::Instrumentations::CountProjectsWithJiraDvcsIntegrationMetric, - feature_category: :integrations do - describe 'metric value and query' do - let_it_be_with_reload(:project_1) { create(:project) } - let_it_be_with_reload(:project_2) { create(:project) } - let_it_be_with_reload(:project_3) { create(:project) } - - before do - project_1.feature_usage.log_jira_dvcs_integration_usage(cloud: false) - project_2.feature_usage.log_jira_dvcs_integration_usage(cloud: false) - project_3.feature_usage.log_jira_dvcs_integration_usage(cloud: true) - end - - context 'when counting cloud integrations' do - let(:expected_value) { 1 } - let(:expected_query) do - 'SELECT COUNT("project_feature_usages"."project_id") FROM "project_feature_usages" ' \ - 'WHERE "project_feature_usages"."jira_dvcs_cloud_last_sync_at" IS NOT NULL' - end - - it_behaves_like 'a correct instrumented metric value and query', { time_frame: 'all', options: { cloud: true } } - end - - context 'when counting non-cloud integrations' do - let(:expected_value) { 2 } - let(:expected_query) do - 'SELECT COUNT("project_feature_usages"."project_id") FROM "project_feature_usages" ' \ - 'WHERE "project_feature_usages"."jira_dvcs_server_last_sync_at" IS NOT NULL' - end - - it_behaves_like 'a correct instrumented metric value and query', { time_frame: 'all', options: { cloud: false } } - end - end - - it "raises an exception if option is not present" do - expect do - described_class.new(options: {}, time_frame: 'all') - end.to raise_error(ArgumentError, %r{must be a boolean}) - end - - it "raises an exception if option has invalid value" do - expect do - described_class.new(options: { cloud: 'yes' }, time_frame: 'all') - end.to raise_error(ArgumentError, %r{must be a boolean}) - end -end