diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
commit | 71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch) | |
tree | 6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /lib/gitlab/usage_data_counters | |
parent | a7253423e3403b8c08f8a161e5937e1488f5f407 (diff) |
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'lib/gitlab/usage_data_counters')
9 files changed, 61 insertions, 45 deletions
diff --git a/lib/gitlab/usage_data_counters/ci_template_unique_counter.rb b/lib/gitlab/usage_data_counters/ci_template_unique_counter.rb index eb040e9e819..7f6d67e01c7 100644 --- a/lib/gitlab/usage_data_counters/ci_template_unique_counter.rb +++ b/lib/gitlab/usage_data_counters/ci_template_unique_counter.rb @@ -14,14 +14,11 @@ module Gitlab::UsageDataCounters Gitlab::UsageDataCounters::HLLRedisCounter.track_event(event_name, values: project.id) namespace = project.namespace - if Feature.enabled?(:route_hll_to_snowplow, namespace) - context = Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, - event: event_name).to_context - label = 'redis_hll_counters.ci_templates.ci_templates_total_unique_counts_monthly' - Gitlab::Tracking.event(name, 'ci_templates_unique', namespace: namespace, - project: project, context: [context], user: user, - label: label) - end + context = Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, + event: event_name).to_context + label = 'redis_hll_counters.ci_templates.ci_templates_total_unique_counts_monthly' + Gitlab::Tracking.event(name, 'ci_templates_unique', namespace: namespace, + project: project, context: [context], user: user, label: label) end def ci_templates(relative_base = 'lib/gitlab/ci/templates') @@ -42,9 +39,9 @@ module Gitlab::UsageDataCounters expanded_template_name = expand_template_name(template_name) results = [expanded_template_name].tap do |result| template = Gitlab::Template::GitlabCiYmlTemplate.find(template_name.chomp('.gitlab-ci.yml')) - data = YAML.safe_load(template.content, aliases: true) - [data['include']].compact.flatten.each do |ci_include| - if ci_include_template = ci_include['template'] + data = Gitlab::Ci::Config::Yaml.load!(template.content) + [data[:include]].compact.flatten.each do |ci_include| + if ci_include_template = ci_include[:template] result.concat(all_included_templates(ci_include_template)) end end diff --git a/lib/gitlab/usage_data_counters/editor_unique_counter.rb b/lib/gitlab/usage_data_counters/editor_unique_counter.rb index 0b448f68153..2aebc1b8813 100644 --- a/lib/gitlab/usage_data_counters/editor_unique_counter.rb +++ b/lib/gitlab/usage_data_counters/editor_unique_counter.rb @@ -7,7 +7,6 @@ module Gitlab EDIT_BY_SFE = 'g_edit_by_sfe' EDIT_BY_WEB_IDE = 'g_edit_by_web_ide' EDIT_CATEGORY = 'ide_edit' - EDIT_BY_LIVE_PREVIEW = 'g_edit_by_live_preview' class << self def track_web_ide_edit_action(author:, time: Time.zone.now, project:) @@ -34,15 +33,6 @@ module Gitlab count_unique(EDIT_BY_SNIPPET_EDITOR, date_from, date_to) end - def count_edit_using_editor(date_from:, date_to:) - events = Gitlab::UsageDataCounters::HLLRedisCounter.events_for_category(EDIT_CATEGORY) - count_unique(events, date_from, date_to) - end - - def track_live_preview_edit_action(author:, time: Time.zone.now, project:) - track_unique_action(EDIT_BY_LIVE_PREVIEW, author, time, project) - end - private def track_unique_action(event_name, author, time, project = nil) diff --git a/lib/gitlab/usage_data_counters/hll_redis_counter.rb b/lib/gitlab/usage_data_counters/hll_redis_counter.rb index 992cec2d174..b809e6c4e42 100644 --- a/lib/gitlab/usage_data_counters/hll_redis_counter.rb +++ b/lib/gitlab/usage_data_counters/hll_redis_counter.rb @@ -35,7 +35,6 @@ module Gitlab # - name: g_compliance_dashboard # Unique event name # redis_slot: compliance # Optional slot name, if not defined it will use name as a slot, used for totals # category: compliance # Group events in categories - # expiry: 29 # Optional expiration time in days, default value 29 days for daily and 6.weeks for weekly # aggregation: daily # Aggregation level, keys are stored daily or weekly # feature_flag: # The event feature flag # @@ -203,8 +202,6 @@ module Gitlab end def expiry(event) - return event[:expiry].days if event[:expiry].present? - event[:aggregation].to_sym == :daily ? DEFAULT_DAILY_KEY_EXPIRY_LENGTH : DEFAULT_WEEKLY_KEY_EXPIRY_LENGTH end diff --git a/lib/gitlab/usage_data_counters/issue_activity_unique_counter.rb b/lib/gitlab/usage_data_counters/issue_activity_unique_counter.rb index 477fa288874..a59ea36961d 100644 --- a/lib/gitlab/usage_data_counters/issue_activity_unique_counter.rb +++ b/lib/gitlab/usage_data_counters/issue_activity_unique_counter.rb @@ -34,6 +34,7 @@ module Gitlab ISSUE_COMMENT_ADDED = 'g_project_management_issue_comment_added' ISSUE_COMMENT_EDITED = 'g_project_management_issue_comment_edited' ISSUE_COMMENT_REMOVED = 'g_project_management_issue_comment_removed' + ISSUE_DESIGN_COMMENT_REMOVED = 'g_project_management_issue_design_comments_removed' class << self def track_issue_created_action(author:, project:) @@ -171,6 +172,11 @@ module Gitlab track_unique_action(ISSUE_CLONED, author) end + def track_issue_design_comment_removed_action(author:, project:) + track_snowplow_action(ISSUE_DESIGN_COMMENT_REMOVED, author, project) + track_unique_action(ISSUE_DESIGN_COMMENT_REMOVED, author) + end + private def track_snowplow_action(event_name, author, project) diff --git a/lib/gitlab/usage_data_counters/known_events/ci_templates.yml b/lib/gitlab/usage_data_counters/known_events/ci_templates.yml index b9f143a3a56..b13e3d631c7 100644 --- a/lib/gitlab/usage_data_counters/known_events/ci_templates.yml +++ b/lib/gitlab/usage_data_counters/known_events/ci_templates.yml @@ -595,3 +595,11 @@ category: ci_templates redis_slot: ci_templates aggregation: weekly +- name: p_ci_templates_terraform_module_base + category: ci_templates + redis_slot: ci_templates + aggregation: weekly +- name: p_ci_templates_terraform_module + category: ci_templates + redis_slot: ci_templates + aggregation: weekly diff --git a/lib/gitlab/usage_data_counters/known_events/common.yml b/lib/gitlab/usage_data_counters/known_events/common.yml index a64b7c4032b..ae15530f0d0 100644 --- a/lib/gitlab/usage_data_counters/known_events/common.yml +++ b/lib/gitlab/usage_data_counters/known_events/common.yml @@ -3,22 +3,18 @@ - name: g_edit_by_web_ide category: ide_edit redis_slot: edit - expiry: 29 aggregation: daily - name: g_edit_by_sfe category: ide_edit redis_slot: edit - expiry: 29 aggregation: daily - name: g_edit_by_snippet_ide category: ide_edit redis_slot: edit - expiry: 29 aggregation: daily - name: g_edit_by_live_preview category: ide_edit redis_slot: edit - expiry: 29 aggregation: daily - name: i_search_total category: search @@ -216,6 +212,10 @@ category: issues_edit redis_slot: project_management aggregation: daily +- name: g_project_management_issue_design_comments_removed + category: issues_edit + redis_slot: project_management + aggregation: daily - name: g_project_management_issue_time_estimate_changed category: issues_edit redis_slot: project_management @@ -240,6 +240,11 @@ category: issues_edit redis_slot: project_management aggregation: daily +# Runner group +- name: g_runner_fleet_read_jobs_statistics + category: runner + redis_slot: runner + aggregation: weekly # Secrets Management - name: i_snippets_show category: snippets @@ -250,7 +255,7 @@ category: terraform redis_slot: terraform aggregation: weekly -# Pipeline Authoring +# Pipeline Authoring group - name: o_pipeline_authoring_unique_users_committing_ciconfigfile category: pipeline_authoring redis_slot: pipeline_authoring @@ -259,6 +264,10 @@ category: pipeline_authoring redis_slot: pipeline_authoring aggregation: weekly +- name: i_ci_secrets_management_id_tokens_build_created + category: ci_secrets_management + redis_slot: ci_secrets_management + aggregation: weekly # Merge request widgets - name: users_expanding_secure_security_report redis_slot: secure @@ -297,7 +306,6 @@ - name: unique_active_user category: manage aggregation: weekly - expiry: 42 # Environments page - name: users_visiting_environments_pages category: environments diff --git a/lib/gitlab/usage_data_counters/known_events/container_registry_events.yml b/lib/gitlab/usage_data_counters/known_events/container_registry_events.yml new file mode 100644 index 00000000000..e8b14de1769 --- /dev/null +++ b/lib/gitlab/usage_data_counters/known_events/container_registry_events.yml @@ -0,0 +1,22 @@ +--- +- name: i_container_registry_push_tag_user + category: user_container_registry + aggregation: weekly + redis_slot: container_registry +- name: i_container_registry_delete_tag_user + category: user_container_registry + aggregation: weekly + redis_slot: container_registry +- name: i_container_registry_push_repository_user + category: user_container_registry + aggregation: weekly + redis_slot: container_registry +- name: i_container_registry_delete_repository_user + category: user_container_registry + aggregation: weekly + redis_slot: container_registry +- name: i_container_registry_create_repository_user + category: user_container_registry + aggregation: weekly + redis_slot: container_registry +
\ No newline at end of file diff --git a/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb b/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb index 10dae35d0bf..c8768164710 100644 --- a/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb +++ b/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb @@ -76,10 +76,10 @@ module Gitlab project: project, namespace: project.namespace, user: user, - property: MR_CREATE_ACTION, - label: 'redis_hll_counters.code_review.i_code_review_create_mr_monthly', + property: MR_USER_CREATE_ACTION, + label: 'redis_hll_counters.code_review.i_code_review_user_create_mr_monthly', context: [Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, - event: MR_CREATE_ACTION).to_context] + event: MR_USER_CREATE_ACTION).to_context] ) end diff --git a/lib/gitlab/usage_data_counters/web_ide_counter.rb b/lib/gitlab/usage_data_counters/web_ide_counter.rb index f2753c8f215..904729f114f 100644 --- a/lib/gitlab/usage_data_counters/web_ide_counter.rb +++ b/lib/gitlab/usage_data_counters/web_ide_counter.rb @@ -27,18 +27,6 @@ module Gitlab count('pipelines') end - def increment_previews_count - return unless Gitlab::CurrentSettings.web_ide_clientside_preview_enabled? - - count('previews') - end - - def increment_previews_success_count - return unless Gitlab::CurrentSettings.web_ide_clientside_preview_enabled? - - count('previews_success') - end - private def redis_key(event) |