Skip to content
Snippets Groups Projects
Commit b52485d8 authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak :one: Committed by Mikołaj Wawrzyniak
Browse files

Migrate security_products_usage metrics

Migrate security_products_usage metrics to instrumentation classes
parent c718dbcf
No related branches found
No related tags found
1 merge request!102289Migrate security_products_usage metrics to instrumentation classes
......@@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: all
data_source: database
instrumentation_class: CountCiBuildsMetric
options:
secure_type: container_scanning
distribution:
- ee
tier:
......
......@@ -149,17 +149,6 @@ def approval_rules_counts
end
# rubocop:enable CodeReuse/ActiveRecord, UsageData/LargeTable
def security_products_usage
results = SECURE_PRODUCT_TYPES.each_with_object({}) do |(secure_type, attribs), response|
next if secure_type.in?([:license_management, :license_scanning])
response[attribs[:name]] = add_metric('CountCiBuildsMetric', options: { secure_type: secure_type })
end
results[:license_management_jobs] = add_metric("LicenseManagementJobsMetric")
results
end
def on_demand_pipelines_usage
{ dast_on_demand_pipelines: count(::Ci::Pipeline.ondemand_dast_scan) }
end
......@@ -217,7 +206,6 @@ def system_usage_data
template_repositories: add(count(::Project.with_repos_templates), count(::Project.with_groups_level_repos_templates))
},
requirements_counts,
security_products_usage,
on_demand_pipelines_usage,
operations_dashboard_usage)
end
......
......@@ -100,10 +100,6 @@
expect(count_data.keys).to include(
*%i(
confidential_epics
container_scanning_jobs
coverage_fuzzing_jobs
dast_jobs
dependency_scanning_jobs
epics
epic_issues
geo_nodes
......@@ -112,14 +108,11 @@
ldap_group_links
ldap_keys
ldap_users
license_management_jobs
operations_dashboard_default_dashboard
operations_dashboard_users_with_projects_added
projects_jira_issuelist_active
projects_mirrored_with_pipelines_enabled
projects_reporting_ci_cd_back_to_github
sast_jobs
secret_detection_jobs
status_page_issues
status_page_projects
user_preferences_group_overview_details
......@@ -134,16 +127,7 @@
expect(count_data[:epic_issues]).to eq(2)
end
it 'gathers security products usage data', :aggregate_failures 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(2)
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)
it 'gathers security products usage data' do
expect(count_data[:dast_on_demand_pipelines]).to eq(1)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment