Commit fd420b47 authored by Max Woolf's avatar Max Woolf Committed by Matthias Käppler

Add compliance_frameworks_with_pipeline to usage ping

Adds a new usage ping counter to count the number of custom
compliance frameworks that have GitLab CI configuration
associated with it.

Changelog: added
EE: true
parent e430a1ed
# frozen_string_literal: true
class AddIndexToComplianceManagementFrameworksPipelineConfiguration < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
INDEX_NAME = 'index_compliance_frameworks_id_where_frameworks_not_null'
def up
add_concurrent_index :compliance_management_frameworks, :id, name: INDEX_NAME, where: 'pipeline_configuration_full_path IS NOT NULL'
end
def down
remove_concurrent_index_by_name :compliance_management_frameworks, INDEX_NAME
end
end
6732401a959a7a691b8729e2bfb38e010dd4da4cd04418aada22946c42fdd6dc
\ No newline at end of file
...@@ -23110,6 +23110,8 @@ CREATE INDEX index_clusters_on_user_id ON clusters USING btree (user_id); ...@@ -23110,6 +23110,8 @@ CREATE INDEX index_clusters_on_user_id ON clusters USING btree (user_id);
CREATE UNIQUE INDEX index_commit_user_mentions_on_note_id ON commit_user_mentions USING btree (note_id); CREATE UNIQUE INDEX index_commit_user_mentions_on_note_id ON commit_user_mentions USING btree (note_id);
CREATE INDEX index_compliance_frameworks_id_where_frameworks_not_null ON compliance_management_frameworks USING btree (id) WHERE (pipeline_configuration_full_path IS NOT NULL);
CREATE INDEX index_composer_cache_files_where_namespace_id_is_null ON packages_composer_cache_files USING btree (id) WHERE (namespace_id IS NULL); CREATE INDEX index_composer_cache_files_where_namespace_id_is_null ON packages_composer_cache_files USING btree (id) WHERE (namespace_id IS NULL);
CREATE INDEX index_container_expiration_policies_on_next_run_at_and_enabled ON container_expiration_policies USING btree (next_run_at, enabled); CREATE INDEX index_container_expiration_policies_on_next_run_at_and_enabled ON container_expiration_policies USING btree (next_run_at, enabled);
...@@ -16332,6 +16332,18 @@ Status: `data_available` ...@@ -16332,6 +16332,18 @@ Status: `data_available`
Tiers: `free` Tiers: `free`
### `usage_activity_by_stage.manage.compliance_frameworks_with_pipeline`
Count of compliance frameworks that have a pipeline configuration
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_all/20210622123800_compliance_frameworks_with_pipeline.yml)
Group: `compliance`
Status: `implemented`
Tiers: `ultimate`
### `usage_activity_by_stage.manage.custom_compliance_frameworks` ### `usage_activity_by_stage.manage.custom_compliance_frameworks`
Total count of all custom compliance framework labels Total count of all custom compliance framework labels
...@@ -18398,6 +18410,18 @@ Status: `data_available` ...@@ -18398,6 +18410,18 @@ Status: `data_available`
Tiers: `free` Tiers: `free`
### `usage_activity_by_stage_monthly.manage.compliance_frameworks_with_pipeline`
Count of compliance frameworks that have a pipeline configuration
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210622091519_compliance_frameworks_with_pipeline.yml)
Group: `compliance`
Status: `implemented`
Tiers: `ultimate`
### `usage_activity_by_stage_monthly.manage.custom_compliance_frameworks` ### `usage_activity_by_stage_monthly.manage.custom_compliance_frameworks`
Monthly count of all custom compliance framework labels Monthly count of all custom compliance framework labels
......
---
key_path: usage_activity_by_stage_monthly.manage.compliance_frameworks_with_pipeline
name: "count_distinct_montlpipeline_containing_compliance_management_frameworks"
description: "Count of compliance frameworks that have a pipeline configuration"
product_section: dev
product_stage: manage
product_group: compliance
product_category: "Compliance management"
value_type: number
status: implemented
milestone: "14.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/329897
time_frame: 28d
data_source: database
data_category: Optional
distribution:
- ee
tier:
- ultimate
---
key_path: usage_activity_by_stage.manage.compliance_frameworks_with_pipeline
name: "count_distinct_pipeline_containing_compliance_management_frameworks"
description: "Count of compliance frameworks that have a pipeline configuration"
product_section: dev
product_stage: manage
product_group: compliance
product_category: "Compliance management"
value_type: number
status: implemented
milestone: "14.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64601
time_frame: all
data_source: database
data_category: Optional
distribution:
- ee
tier:
- ultimate
...@@ -308,6 +308,7 @@ module EE ...@@ -308,6 +308,7 @@ module EE
value_stream_management_customized_group_stages: count(::Analytics::CycleAnalytics::GroupStage.where(custom: true)), value_stream_management_customized_group_stages: count(::Analytics::CycleAnalytics::GroupStage.where(custom: true)),
projects_with_compliance_framework: count(::ComplianceManagement::ComplianceFramework::ProjectSettings), projects_with_compliance_framework: count(::ComplianceManagement::ComplianceFramework::ProjectSettings),
custom_compliance_frameworks: count(::ComplianceManagement::Framework), custom_compliance_frameworks: count(::ComplianceManagement::Framework),
compliance_frameworks_with_pipeline: count(::ComplianceManagement::Framework.where.not(pipeline_configuration_full_path: nil)),
ldap_servers: ldap_available_servers.size, ldap_servers: ldap_available_servers.size,
ldap_group_sync_enabled: ldap_config_present_for_any_provider?(:group_base), ldap_group_sync_enabled: ldap_config_present_for_any_provider?(:group_base),
ldap_admin_sync_enabled: ldap_config_present_for_any_provider?(:admin_group), ldap_admin_sync_enabled: ldap_config_present_for_any_provider?(:admin_group),
......
...@@ -12,5 +12,9 @@ FactoryBot.define do ...@@ -12,5 +12,9 @@ FactoryBot.define do
trait :sox do trait :sox do
name { 'SOX' } name { 'SOX' }
end end
trait :with_pipeline do
pipeline_configuration_full_path { 'compliance.gitlab-ci.yml@test-project' }
end
end end
end end
...@@ -415,6 +415,7 @@ RSpec.describe Gitlab::UsageData do ...@@ -415,6 +415,7 @@ RSpec.describe Gitlab::UsageData do
create(:cycle_analytics_group_stage) create(:cycle_analytics_group_stage)
create(:compliance_framework_project_setting) create(:compliance_framework_project_setting)
create(:compliance_framework) create(:compliance_framework)
create(:compliance_framework, :with_pipeline)
end end
expect(described_class.usage_activity_by_stage_manage({})).to include( expect(described_class.usage_activity_by_stage_manage({})).to include(
...@@ -422,7 +423,8 @@ RSpec.describe Gitlab::UsageData do ...@@ -422,7 +423,8 @@ RSpec.describe Gitlab::UsageData do
ldap_users: 2, ldap_users: 2,
value_stream_management_customized_group_stages: 2, value_stream_management_customized_group_stages: 2,
projects_with_compliance_framework: 2, projects_with_compliance_framework: 2,
custom_compliance_frameworks: 4, custom_compliance_frameworks: 6,
compliance_frameworks_with_pipeline: 2,
ldap_servers: 2, ldap_servers: 2,
ldap_group_sync_enabled: true, ldap_group_sync_enabled: true,
ldap_admin_sync_enabled: true, ldap_admin_sync_enabled: true,
...@@ -433,7 +435,8 @@ RSpec.describe Gitlab::UsageData do ...@@ -433,7 +435,8 @@ RSpec.describe Gitlab::UsageData do
ldap_users: 1, ldap_users: 1,
value_stream_management_customized_group_stages: 2, value_stream_management_customized_group_stages: 2,
projects_with_compliance_framework: 2, projects_with_compliance_framework: 2,
custom_compliance_frameworks: 4, custom_compliance_frameworks: 6,
compliance_frameworks_with_pipeline: 2,
ldap_servers: 2, ldap_servers: 2,
ldap_group_sync_enabled: true, ldap_group_sync_enabled: true,
ldap_admin_sync_enabled: true, ldap_admin_sync_enabled: true,
......
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