Commit 7197509e authored by Mikolaj Wawrzyniak's avatar Mikolaj Wawrzyniak

Enable quarantined service ping metrics

At https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71722
secure product type metrics was put into quarantine due to performance
issues. Underlying index problem was resolved by
https://gitlab.com/gitlab-org/gitlab/-/issues/343455 and
service ping report was successfully generated for gitlab.com.
There is no more a need to keep this metrics in quarantine.
Therefore corresponding feaure flag is removed.

Changelog: other
EE: true
parent cd56feb8
---
name: allow_quarantined_security_products_usage_metrics
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71722
rollout_issue_url:
milestone: '14.4'
type: ops
group: group::product intelligence
default_enabled: false
...@@ -144,11 +144,7 @@ module EE ...@@ -144,11 +144,7 @@ module EE
def security_products_usage def security_products_usage
results = SECURE_PRODUCT_TYPES.each_with_object({}) do |(secure_type, attribs), response| results = SECURE_PRODUCT_TYPES.each_with_object({}) do |(secure_type, attribs), response|
response[attribs[:name]] = if ::Feature.enabled?(:allow_quarantined_security_products_usage_metrics, type: :ops, default_enabled: :yaml) response[attribs[:name]] = count(::Ci::Build.where(name: secure_type)) # rubocop:disable CodeReuse/ActiveRecord
count(::Ci::Build.where(name: secure_type)) # rubocop:disable CodeReuse/ActiveRecord
else
::Gitlab::Database::BatchCounter::FALLBACK
end
end end
# handle license rename https://gitlab.com/gitlab-org/gitlab/issues/8911 # handle license rename https://gitlab.com/gitlab-org/gitlab/issues/8911
......
...@@ -128,7 +128,6 @@ RSpec.describe Gitlab::UsageData do ...@@ -128,7 +128,6 @@ RSpec.describe Gitlab::UsageData do
expect(count_data[:epic_issues]).to eq(2) expect(count_data[:epic_issues]).to eq(2)
end end
context 'with allow_quarantined_security_products_usage_metrics turned on' do
it 'gathers security products usage data' do it 'gathers security products usage data' do
expect(count_data[:container_scanning_jobs]).to eq(1) expect(count_data[:container_scanning_jobs]).to eq(1)
expect(count_data[:dast_jobs]).to eq(1) expect(count_data[:dast_jobs]).to eq(1)
...@@ -142,38 +141,6 @@ RSpec.describe Gitlab::UsageData do ...@@ -142,38 +141,6 @@ RSpec.describe Gitlab::UsageData do
expect(count_data[:dast_on_demand_pipelines]).to eq(1) expect(count_data[:dast_on_demand_pipelines]).to eq(1)
end end
it 'counts metrics data' do
expect(described_class).to receive(:count).exactly(10).times
described_class.security_products_usage
end
end
context 'with allow_quarantined_security_products_usage_metrics turned off' do
before do
stub_feature_flags(allow_quarantined_security_products_usage_metrics: false)
end
it 'avoid counting metrics' do
expect(described_class).not_to receive(:count)
described_class.security_products_usage
end
it 'returns fallback value for quarantined security products usage data' do
expect(count_data[:container_scanning_jobs]).to eq(-1)
expect(count_data[:dast_jobs]).to eq(-1)
expect(count_data[:dependency_scanning_jobs]).to eq(-1)
expect(count_data[:license_management_jobs]).to eq(-1)
expect(count_data[:sast_jobs]).to eq(-1)
expect(count_data[:secret_detection_jobs]).to eq(-1)
expect(count_data[:coverage_fuzzing_jobs]).to eq(-1)
expect(count_data[:api_fuzzing_jobs]).to eq(-1)
expect(count_data[:api_fuzzing_dnd_jobs]).to eq(-1)
expect(count_data[:dast_on_demand_pipelines]).to eq(1)
end
end
it 'gathers group overview preferences usage data', :aggregate_failures do it 'gathers group overview preferences usage data', :aggregate_failures do
expect(subject[:counts][:user_preferences_group_overview_details]).to eq(User.active.count - 2) # we have exactly 2 active users with security dashboard set expect(subject[:counts][:user_preferences_group_overview_details]).to eq(User.active.count - 2) # we have exactly 2 active users with security dashboard set
expect(subject[:counts][:user_preferences_group_overview_security_dashboard]).to eq 2 expect(subject[:counts][:user_preferences_group_overview_security_dashboard]).to eq 2
......
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