Skip to content
代码片段 群组 项目
提交 e61b83ba 编辑于 作者: Bojan Marjanovic's avatar Bojan Marjanovic 提交者: Sashi Kumar Kumaresan
浏览文件

Remove `projects_jira_dvcs_cloud_active` metric

上级 d9dd263c
No related branches found
No related tags found
无相关合并请求
...@@ -19,19 +19,6 @@ def jira_dvcs_integration_field(cloud: true) ...@@ -19,19 +19,6 @@ def jira_dvcs_integration_field(cloud: true)
end end
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 private
def updated_today?(integration_field) def updated_today?(integration_field)
......
...@@ -6,7 +6,7 @@ product_section: dev ...@@ -6,7 +6,7 @@ product_section: dev
product_stage: manage product_stage: manage
product_group: integrations product_group: integrations
value_type: number value_type: number
status: active status: removed
time_frame: all time_frame: all
data_source: database data_source: database
instrumentation_class: CountProjectsWithJiraDvcsIntegrationMetric instrumentation_class: CountProjectsWithJiraDvcsIntegrationMetric
...@@ -21,3 +21,5 @@ tier: ...@@ -21,3 +21,5 @@ tier:
- ultimate - ultimate
performance_indicator_type: [] performance_indicator_type: []
milestone: "<13.9" milestone: "<13.9"
removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/135755
milestone_removed: "<16.6"
# 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
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册