Commit 25055d45 authored by Steve Abrams's avatar Steve Abrams

Merge branch 'deprecate-user-secure-metrics' into 'master'

Deprecate Secure user_[analyzer]_scan service ping metrics

See merge request gitlab-org/gitlab!67738
parents 46bb9dc7 c4ae56bc
......@@ -6,7 +6,7 @@ product_stage: secure
product_group: group::dynamic analysis
product_category: dynamic_application_security_testing
value_type: number
status: data_available
status: deprecated
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: 28d
data_source: database
......
......@@ -6,7 +6,7 @@ product_stage: secure
product_group: group::static analysis
product_category: static_application_security_testing
value_type: number
status: data_available
status: deprecated
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: 28d
data_source: database
......
......@@ -6,7 +6,7 @@ product_stage: secure
product_group: group::composition analysis
product_category: dependency_scanning
value_type: number
status: data_available
status: deprecated
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: 28d
data_source: database
......
......@@ -6,7 +6,7 @@ product_stage: secure
product_group: group::composition analysis
product_category: container_scanning
value_type: number
status: data_available
status: deprecated
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: 28d
data_source: database
......
......@@ -6,7 +6,7 @@ product_stage: secure
product_group: group::static analysis
product_category: secret_detection
value_type: number
status: data_available
status: deprecated
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: 28d
data_source: database
......
......@@ -6,7 +6,7 @@ product_stage: secure
product_group: group::dynamic analysis
product_category: fuzz-testing
value_type: number
status: data_available
status: deprecated
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: 28d
data_source: database
......
......@@ -6,7 +6,7 @@ product_stage: secure
product_group: group::dynamic analysis
product_category: fuzz-testing
value_type: number
status: data_available
status: deprecated
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: 28d
data_source: database
......
---
key_path: usage_activity_by_stage_monthly.secure.user_cluster_image_scanning_scans
description: Number of users who have run a Cluster image scan
product_section: sec
product_stage: protect
product_group: group::container security
value_type: number
status: deprecated
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: 28d
data_source: database
data_category: Operational
distribution:
- ee
tier:
- ultimate
......@@ -6,11 +6,11 @@ product_stage: secure
product_group: group::dynamic analysis
product_category: dynamic_application_security_testing
value_type: number
status: data_available
status: deprecated
data_category: optional
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: all
data_source: database
data_category: operational
distribution:
- ee
tier:
......
......@@ -6,7 +6,7 @@ product_stage: secure
product_group: group::static analysis
product_category: static_application_security_testing
value_type: number
status: data_available
status: deprecated
data_category: optional
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: all
......
......@@ -6,7 +6,7 @@ product_stage: secure
product_group: group::composition analysis
product_category: dependency_scanning
value_type: number
status: data_available
status: deprecated
data_category: optional
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: all
......
......@@ -6,7 +6,7 @@ product_stage: secure
product_group: group::composition analysis
product_category: container_scanning
value_type: number
status: data_available
status: deprecated
data_category: optional
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: all
......
......@@ -6,7 +6,7 @@ product_stage: secure
product_group: group::static analysis
product_category: secret_detection
value_type: number
status: data_available
status: deprecated
data_category: optional
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: all
......
......@@ -6,7 +6,8 @@ product_stage: secure
product_group: group::dynamic analysis
product_category: fuzz-testing
value_type: number
status: data_available
status: deprecated
data_category: optional
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: all
data_source: database
......
......@@ -6,7 +6,7 @@ product_stage: secure
product_group: group::dynamic analysis
product_category: fuzz-testing
value_type: number
status: data_available
status: deprecated
data_category: optional
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: all
......
---
key_path: usage_activity_by_stage.secure.user_cluster_image_scanning_scans
description: Number of users who have run a Cluster image scan
product_section: sec
product_stage: protect
product_group: group::container security
value_type: number
status: deprecated
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame: all
data_source: database
data_category: Optional
distribution:
- ee
tier:
- ultimate
......@@ -370,7 +370,7 @@ module EE
finish: maximum_id(::User))
end
results.merge!(count_secure_user_scans(time_period))
results.merge!(count_secure_user_scans)
results.merge!(count_secure_pipelines(time_period))
results.merge!(count_secure_scans(time_period))
......@@ -388,28 +388,10 @@ module EE
private
# rubocop:disable UsageData/LargeTable
# rubocop:disable CodeReuse/ActiveRecord
def count_secure_user_scans(time_period)
return {} if time_period.blank?
user_scans = {}
start_id, finish_id = min_max_security_scan_id(time_period)
::Security::Scan.scan_types.each do |name, scan_type|
relation = ::Security::Scan
.latest_successful_by_build
.by_scan_types(scan_type)
.where(security_scans: time_period)
if start_id && finish_id
user_scans["user_#{name}_scans".to_sym] = estimate_batch_distinct_count(relation, :user_id, batch_size: 1000, start: start_id, finish: finish_id)
end
end
user_scans
def count_secure_user_scans
::Security::Scan.scan_types.to_h { |name, _| ["user_#{name}_scans".to_sym, ::Gitlab::UsageData::DEPRECATED_VALUE] }
end
# rubocop:enable UsageData/LargeTable
# rubocop:enable CodeReuse/ActiveRecord
# rubocop:disable CodeReuse/ActiveRecord
# rubocop: disable UsageData/LargeTable
......
......@@ -29,13 +29,6 @@ RSpec.describe 'Every metric definition' do
mock_ci
mock_monitoring
user_auth_by_provider
user_dast_scans
user_sast_scans
user_dependency_scanning_scans
user_container_scanning_scans
user_secret_detection_scans
user_coverage_fuzzing_scans
user_api_fuzzing_scans
).freeze
end
......
......@@ -15,7 +15,7 @@ RSpec.describe Gitlab::UsageDataNonSqlMetrics do
described_class.uncached_data
end
expect(recorder.count).to eq(56)
expect(recorder.count).to eq(54)
end
end
end
......@@ -744,30 +744,15 @@ RSpec.describe Gitlab::UsageData do
)
end
it 'counts users who have run scans' do
for_defined_days_back do
create(:ee_ci_build, :api_fuzzing, :success, user: user3)
create(:ee_ci_build, :dast, :running, user: user2)
create(:ee_ci_build, :dast, :success, user: user3)
create(:ee_ci_build, :container_scanning, :success, user: user3)
create(:ee_ci_build, :coverage_fuzzing, :success, user: user)
create(:ee_ci_build, :dependency_scanning, :success, user: user)
create(:ee_ci_build, :dependency_scanning, :failed, user: user2)
create(:ee_ci_build, :sast, :success, user: user2)
create(:ee_ci_build, :sast, :success, user: user3)
create(:ee_ci_build, :secret_detection, :success, user: user)
create(:ee_ci_build, :secret_detection, :success, user: user)
create(:ee_ci_build, :secret_detection, :failed, user: user2)
end
it 'deprecates count for users who have run scans' do
expect(described_class.usage_activity_by_stage_secure(described_class.monthly_time_range_db_params)).to include(
user_api_fuzzing_scans: be_within(error_rate).percent_of(1),
user_container_scanning_scans: be_within(error_rate).percent_of(1),
user_coverage_fuzzing_scans: be_within(error_rate).percent_of(1),
user_dast_scans: be_within(error_rate).percent_of(1),
user_dependency_scanning_scans: be_within(error_rate).percent_of(1),
user_sast_scans: be_within(error_rate).percent_of(2),
user_secret_detection_scans: be_within(error_rate).percent_of(1)
user_api_fuzzing_scans: described_class::DEPRECATED_VALUE,
user_container_scanning_scans: described_class::DEPRECATED_VALUE,
user_coverage_fuzzing_scans: described_class::DEPRECATED_VALUE,
user_dast_scans: described_class::DEPRECATED_VALUE,
user_dependency_scanning_scans: described_class::DEPRECATED_VALUE,
user_sast_scans: described_class::DEPRECATED_VALUE,
user_secret_detection_scans: described_class::DEPRECATED_VALUE
)
end
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