Commit f8e892d9 authored by Alper Akgun's avatar Alper Akgun

Merge branch...

Merge branch '322604-add-a-check-that-the-metric-definitions-are-added-when-new-metrics-are-added-to-usage-ping' into 'master'

Add specs ensuring all metric definition key paths are present in Usage Ping structure

See merge request gitlab-org/gitlab!59314
parents 92cb41df 7ac552dd
---
title: Add specs ensuring all metric definition key paths are present in Usage Ping
structure
merge_request: 59314
author:
type: other
---
key_path: counts_monthly.aggregated_metrics.code_review_category_monthly_active_users
name: "0"
description:
product_section:
product_stage:
product_group:
product_category:
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url:
time_frame: 28d
data_source:
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
skip_validation: true
---
key_path: counts_monthly.aggregated_metrics.code_review_extension_category_monthly_active_users
name: "0"
description:
product_section:
product_stage:
product_group:
product_category:
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url:
time_frame: 28d
data_source:
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
skip_validation: true
---
key_path: counts_monthly.aggregated_metrics.code_review_group_monthly_active_users
name: "0"
description:
product_section:
product_stage:
product_group:
product_category:
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url:
time_frame: 28d
data_source:
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
skip_validation: true
---
key_path: redis_hll_counters.pipeline_authoring.pipeline_authoring_total_unique_counts_monthly
name: "0"
description:
product_section:
product_stage:
product_group:
product_category:
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url:
time_frame: 28d
data_source:
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
skip_validation: true
---
key_path: usage_activity_by_stage_monthly.enablement.geo_secondary_web_oauth_users
name: ""
description:
product_section:
product_stage:
product_group:
product_category:
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url:
time_frame: 28d
data_source:
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
skip_validation: true
---
key_path: counts_weekly.aggregated_metrics.code_review_group_monthly_active_users
name: "0"
description:
product_section:
product_stage:
product_group:
product_category:
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url:
time_frame: 7d
data_source:
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
skip_validation: true
---
key_path: counts_weekly.aggregated_metrics.code_review_category_monthly_active_users
name: "0"
description:
product_section:
product_stage:
product_group:
product_category:
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url:
time_frame: 7d
data_source:
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
skip_validation: true
---
key_path: counts_weekly.aggregated_metrics.code_review_extension_category_monthly_active_users
name: ""
description:
product_section:
product_stage:
product_group:
product_category:
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url:
time_frame: 7d
data_source:
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
skip_validation: true
---
key_path: redis_hll_counters.pipeline_authoring.pipeline_authoring_total_unique_counts_weekly
name: "0"
description:
product_section:
product_stage:
product_group:
product_category:
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url:
time_frame: 7d
data_source:
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
skip_validation: true
---
key_path: analytics_unique_visits.i_analytics_dev_ops_adoption
name: "<please fill metric name, suggested format is: {subject}_{verb}{ing|ed}_{object} eg: users_creating_epics or merge_requests_viewed_in_single_file_mode>"
description:
product_section:
product_stage:
product_group:
product_category:
value_type: number
status: implemented
milestone: "13.11"
introduced_by_url:
time_frame: all
data_source:
distribution:
- ce
# tier:
# - free
# - premium
# - ultimate
skip_validation: true
---
key_path: usage_activity_by_stage.enablement.geo_secondary_web_oauth_users
name: ""
description:
product_section:
product_stage:
product_group:
product_category:
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url:
time_frame: all
data_source:
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
skip_validation: true
---
key_path: analytics_unique_visits.users_viewing_analytics_group_devops_adoption
name: "<please fill metric name, suggested format is: {subject}_{verb}{ing|ed}_{object} eg: users_creating_epics or merge_requests_viewed_in_single_file_mode>"
description:
product_section:
product_stage:
product_group:
product_category:
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url:
time_frame: all
data_source:
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
skip_validation: true
......@@ -154,6 +154,18 @@ Status: `data_available`
Tiers: `free`
### `analytics_unique_visits.i_analytics_dev_ops_adoption`
Missing description
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210423005644_i_analytics_dev_ops_adoption.yml)
Group: ``
Status: `implemented`
Tiers:
### `analytics_unique_visits.i_analytics_dev_ops_score`
Unique visitors to /-/instance_statistics/dev_ops_score
......@@ -262,6 +274,18 @@ Status: `data_available`
Tiers: `free`
### `analytics_unique_visits.users_viewing_analytics_group_devops_adoption`
Missing description
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210428142406_users_viewing_analytics_group_devops_adoption.yml)
Group: ``
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `compliance_unique_visits.a_compliance_audit_events_api`
Missing description
......@@ -6562,6 +6586,42 @@ Status: `data_available`
Tiers: `free`
### `counts_monthly.aggregated_metrics.code_review_category_monthly_active_users`
Missing description
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210427102618_code_review_category_monthly_active_users.yml)
Group: ``
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts_monthly.aggregated_metrics.code_review_extension_category_monthly_active_users`
Missing description
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210427103010_code_review_extension_category_monthly_active_users.yml)
Group: ``
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts_monthly.aggregated_metrics.code_review_group_monthly_active_users`
Missing description
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210427103119_code_review_group_monthly_active_users.yml)
Group: ``
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts_monthly.aggregated_metrics.compliance_features_track_unique_visits_union`
Missing description
......@@ -6730,6 +6790,42 @@ Status: `data_available`
Tiers: `free`
### `counts_weekly.aggregated_metrics.code_review_category_monthly_active_users`
Missing description
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210427103407_code_review_category_monthly_active_users.yml)
Group: ``
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts_weekly.aggregated_metrics.code_review_extension_category_monthly_active_users`
Missing description
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210427103452_code_review_extension_category_monthly_active_users.yml)
Group: ``
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts_weekly.aggregated_metrics.code_review_group_monthly_active_users`
Missing description
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210427103328_code_review_group_monthly_active_users.yml)
Group: ``
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts_weekly.aggregated_metrics.compliance_features_track_unique_visits_union`
Missing description
......@@ -11422,30 +11518,6 @@ Status: `data_available`
Tiers:
### `redis_hll_counters.incident_management.i_incident_management_oncall_notification_sent_monthly`
Count of unique users to receive a notification while on-call
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210405222005_i_incident_management_oncall_notification_sent_monthly.yml)
Group: `group::monitor`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.incident_management.i_incident_management_oncall_notification_sent_weekly`
Count of unique users to receive a notification while on-call
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210405220139_i_incident_management_oncall_notification_sent_weekly.yml)
Group: `group::monitor`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.incident_management.incident_management_alert_assigned_monthly`
Missing description
......@@ -11830,6 +11902,30 @@ Status: `data_available`
Tiers:
### `redis_hll_counters.incident_management_oncall.i_incident_management_oncall_notification_sent_monthly`
Count of unique users to receive a notification while on-call
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210405222005_i_incident_management_oncall_notification_sent_monthly.yml)
Group: `group::monitor`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.incident_management_oncall.i_incident_management_oncall_notification_sent_weekly`
Count of unique users to receive a notification while on-call
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210405220139_i_incident_management_oncall_notification_sent_weekly.yml)
Group: `group::monitor`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.issues_edit.g_project_management_issue_added_to_epic_monthly`
Count of MAU adding an issue to an epic
......@@ -12694,6 +12790,30 @@ Status: `data_available`
Tiers: `free`, `premium`, `ultimate`
### `redis_hll_counters.pipeline_authoring.pipeline_authoring_total_unique_counts_monthly`
Missing description
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210427105033_pipeline_authoring_total_unique_counts_monthly.yml)
Group: ``
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `redis_hll_counters.pipeline_authoring.pipeline_authoring_total_unique_counts_weekly`
Missing description
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210427105030_pipeline_authoring_total_unique_counts_weekly.yml)
Group: ``
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `redis_hll_counters.quickactions.i_quickactions_approve_monthly`
Count of MAU using the `/approve` quick action
......@@ -15948,6 +16068,18 @@ Status: `data_available`
Tiers: `premium`, `ultimate`
### `usage_activity_by_stage.enablement.geo_secondary_web_oauth_users`
Missing description
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210427212450_geo_secondary_web_oauth_users.yml)
Group: ``
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `usage_activity_by_stage.manage.bulk_imports.gitlab`
Distinct count of users that triggered an import using the Group Migration tool
......@@ -17894,6 +18026,18 @@ Status: `data_available`
Tiers: `premium`, `ultimate`
### `usage_activity_by_stage_monthly.enablement.geo_secondary_web_oauth_users`
Missing description
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210427213346_geo_secondary_web_oauth_users.yml)
Group: ``
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `usage_activity_by_stage_monthly.manage.bulk_imports.gitlab`
Missing description
......
---
key_path: redis_hll_counters.incident_management.i_incident_management_oncall_notification_sent_monthly
key_path: redis_hll_counters.incident_management_oncall.i_incident_management_oncall_notification_sent_monthly
description: Count of unique users to receive a notification while on-call
product_section: ops
product_stage: monitor
......
......@@ -2,7 +2,7 @@
# Name of this metric contains g_project_management prefix
# because we are using the same slot from issue_tracking to
# allow data aggregation.
key_path: counts.g_project_management_users_checking_epic_task_monthly
key_path: redis_hll_counters.epics_usage.project_management_users_checking_epic_task_monthly
description: Counts of MAU checking epic task
product_section: dev
product_stage: plan
......@@ -18,4 +18,4 @@ distribution:
- ee
tier:
- premium
- ultimate
\ No newline at end of file
- ultimate
......@@ -2,7 +2,7 @@
# Name of this metric contains g_project_management prefix
# because we are using the same slot from issue_tracking to
# allow data aggregation.
key_path: counts.g_project_management_users_unchecking_epic_task_monthly
key_path: redis_hll_counters.epics_usage.project_management_users_unchecking_epic_task_monthly
description: Counts of MAU unchecking epic task
product_section: dev
product_stage: plan
......@@ -18,4 +18,4 @@ distribution:
- ee
tier:
- premium
- ultimate
\ No newline at end of file
- ultimate
---
key_path: usage_activity_by_stage_monthly.manage.custom_compliance_frameworks
name: "count_compliance_management_frameworks"
description: Monthly count of all custom compliance framework labels
product_section: dev
product_stage: manage
product_group: compliance
product_category: "Compliance management"
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/59314
time_frame: 28d
data_source: database
distribution:
- ee
tier:
- premium
- ultimate
---
key_path: redis_hll_counters.epic_boards_usage.epic_boards_usage_total_unique_counts_monthly
name: "0"
description:
product_section:
product_stage:
product_group:
product_category:
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url:
time_frame: 28d
data_source:
distribution:
- ee
tier:
#- premium
- ultimate
skip_validation: true
---
key_path: redis_hll_counters.incident_management.i_incident_management_oncall_notification_sent_weekly
key_path: redis_hll_counters.incident_management_oncall.i_incident_management_oncall_notification_sent_weekly
description: Count of unique users to receive a notification while on-call
product_section: ops
product_stage: monitor
......
......@@ -2,7 +2,7 @@
# Name of this metric contains g_project_management prefix
# because we are using the same slot from issue_tracking to
# allow data aggregation.
key_path: counts.g_project_management_users_checking_epic_task_weekly
key_path: redis_hll_counters.epics_usage.project_management_users_checking_epic_task_weekly
description: Counts of WAU checking epic task
product_section: dev
product_stage: plan
......@@ -18,4 +18,4 @@ distribution:
- ee
tier:
- premium
- ultimate
\ No newline at end of file
- ultimate
......@@ -2,7 +2,7 @@
# Name of this metric contains g_project_management prefix
# because we are using the same slot from issue_tracking to
# allow data aggregation.
key_path: counts.g_project_management_users_unchecking_epic_task_weekly
key_path: redis_hll_counters.epics_usage.project_management_users_unchecking_epic_task_weekly
description: Counts of WAU unchecking epic task
product_section: dev
product_stage: plan
......
---
key_path: redis_hll_counters.epic_boards_usage.epic_boards_usage_total_unique_counts_weekly
name: "0"
description:
product_section:
product_stage:
product_group:
product_category:
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url:
time_frame: 7d
data_source:
distribution:
- ee
tier:
#- premium
- ultimate
skip_validation: true
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Every metric definition' do
include UsageDataHelpers
let(:usage_ping) { Gitlab::UsageData.uncached_data }
let(:ignored_usage_ping_key_patterns) do
%w(
geo_node_usage
license_add_ons
testing_total_unique_counts
topology
user_auth_by_provider
).freeze
end
let(:usage_ping_key_paths) do
parse_usage_ping_keys(usage_ping)
.flatten
.reject { |v| v =~ Regexp.union(ignored_usage_ping_key_patterns)}
.sort
end
let(:ignored_metric_files_key_patterns) do
%w(
ci_runners_online
geo_node_usage
mock_ci
mock_monitoring
user_auth_by_provider
).freeze
end
let(:metric_files_key_paths) do
Gitlab::Usage::MetricDefinition
.definitions
.reject { |k, v| v.status == 'removed' || v.value_type == 'object' || v.key_path =~ Regexp.union(ignored_metric_files_key_patterns)}
.keys
.sort
end
# Recursively traverse nested Hash of a generated Usage Ping to return an Array of key paths
# in the dotted format used in metric definition YAML files, e.g.: 'count.category.metric_name'
def parse_usage_ping_keys(object, key_path = [])
if object.is_a? Hash
object.each_with_object([]) do |(key, value), result|
result.append parse_usage_ping_keys(value, key_path + [key])
end
else
key_path.join('.')
end
end
before do
allow(Gitlab::UsageData).to receive_messages(count: -1, distinct_count: -1, estimate_batch_distinct_count: -1, sum: -1, alt_usage_data: -1)
allow(Gitlab::Geo).to receive(:enabled?).and_return(true)
stub_licensed_features(requirements: true)
stub_prometheus_queries
end
it 'is included in the Usage Ping hash structure' do
expect(metric_files_key_paths).to match_array(usage_ping_key_paths)
end
end
......@@ -30,7 +30,11 @@ FactoryBot.define do
notify_admins_at { expires_at }
licensee do
{ "Name" => generate(:name) }
{
"Name" => generate(:name),
"Email" => generate(:email),
"Company" => "Company name"
}
end
restrictions do
......
......@@ -427,7 +427,7 @@ module Gitlab
def services_usage
# rubocop: disable UsageData/LargeTable:
Integration.available_services_names.each_with_object({}) do |service_name, response|
Integration.available_services_names(include_dev: false).each_with_object({}) do |service_name, response|
service_type = Integration.service_name_to_type(service_name)
response["projects_#{service_name}_active".to_sym] = count(Integration.active.where.not(project: nil).where(type: service_type))
......
......@@ -8,11 +8,6 @@
redis_slot: analytics
aggregation: weekly
feature_flag: track_unique_visits
- name: g_analytics_merge_request
category: analytics
redis_slot: analytics
aggregation: weekly
feature_flag: track_unique_visits
- name: i_analytics_dev_ops_score
category: analytics
redis_slot: analytics
......
......@@ -38,6 +38,11 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
File.write(path, content)
end
after do
# Reset memoized `definitions` result
described_class.instance_variable_set(:@definitions, nil)
end
it 'has all definitons valid' do
expect { described_class.definitions }.not_to raise_error(Gitlab::Usage::Metric::InvalidMetricError)
end
......@@ -193,8 +198,6 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
File.join(metric2, '**', '*.yml')
]
)
# Reset memoized `definitions` result
described_class.instance_variable_set(:@definitions, nil)
end
after do
......
......@@ -1332,7 +1332,6 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
'i_analytics_dev_ops_score' => 123,
'i_analytics_instance_statistics' => 123,
'p_analytics_merge_request' => 123,
'g_analytics_merge_request' => 123,
'i_analytics_dev_ops_adoption' => 123,
'users_viewing_analytics_group_devops_adoption' => 123,
'analytics_unique_visits_for_any_target' => 543,
......
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