From 301f94cc9b9de6ea11e4c1e515aa772c3e468a67 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 1 Mar 2023 09:08:06 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- Gemfile | 2 +- Gemfile.checksum | 11 +- Gemfile.lock | 26 ++-- .../components/header/validation_segment.vue | 6 +- .../javascripts/saved_replies/components/form.vue | 22 +-- .../javascripts/saved_replies/components/list.vue | 56 ++++---- .../javascripts/saved_replies/pages/index.vue | 50 ++++++- .../queries/saved_replies.query.graphql | 4 +- app/helpers/users/callouts_helper.rb | 25 ++-- app/helpers/web_hooks/web_hooks_helper.rb | 22 ++- app/models/ci/runner_machine.rb | 3 - app/models/concerns/web_hooks/has_web_hooks.rb | 12 +- app/models/project.rb | 2 +- app/models/users/group_callout.rb | 3 +- app/policies/project_policy.rb | 1 - app/views/layouts/group.html.haml | 1 + ...231130_finalize_backfill_user_details_fields.rb | 20 +++ ...31_remove_temp_index_for_user_details_fields.rb | 2 - db/schema_migrations/20221102231130 | 1 + doc/api/graphql/reference/index.md | 1 + doc/development/service_ping/implement.md | 16 +-- lib/gitlab/usage/metrics/aggregates/aggregate.rb | 7 +- .../usage_data_counters/hll_redis_counter.rb | 34 ----- .../usage_data_counters/known_events/analytics.yml | 13 -- .../known_events/ci_templates.yml | 148 --------------------- .../usage_data_counters/known_events/ci_users.yml | 2 - .../known_events/code_review_events.yml | 112 ---------------- .../usage_data_counters/known_events/common.yml | 75 ----------- .../usage_data_counters/known_events/ecosystem.yml | 11 -- .../known_events/error_tracking.yml | 2 - .../known_events/importer_events.yml | 3 - .../known_events/kubernetes_agent.yml | 1 - .../known_events/package_events.yml | 22 --- .../known_events/quickactions.yml | 63 --------- .../known_events/work_items.yml | 7 - lib/tasks/gitlab/packages/events.rake | 1 - locale/gitlab.pot | 3 + .../frontend/saved_replies/components/list_spec.js | 44 ++---- spec/frontend/saved_replies/pages/index_spec.js | 49 +++++++ .../usage_data_counters/code_review_events_spec.rb | 16 ++- .../usage_data_counters/hll_redis_counter_spec.rb | 60 +-------- .../issue_activity_unique_counter_spec.rb | 2 +- spec/lib/gitlab/utils/usage_data_spec.rb | 4 +- ...0_finalize_backfill_user_details_fields_spec.rb | 93 +++++++++++++ .../concerns/web_hooks/has_web_hooks_spec.rb | 41 ++++++ .../web_hooks/has_web_hooks_shared_examples.rb | 2 +- workhorse/go.mod | 4 +- workhorse/go.sum | 8 +- 48 files changed, 398 insertions(+), 715 deletions(-) create mode 100644 db/post_migrate/20221102231130_finalize_backfill_user_details_fields.rb create mode 100644 db/schema_migrations/20221102231130 create mode 100644 spec/frontend/saved_replies/pages/index_spec.js create mode 100644 spec/migrations/20221102231130_finalize_backfill_user_details_fields_spec.rb create mode 100644 spec/models/concerns/web_hooks/has_web_hooks_spec.rb diff --git a/Gemfile b/Gemfile index 6de3d4a43a9..5f12365e395 100644 --- a/Gemfile +++ b/Gemfile @@ -566,7 +566,7 @@ gem 'oj-introspect', '~> 0.7' gem 'multi_json', '~> 1.14.1' gem 'yajl-ruby', '~> 1.4.3', require: 'yajl' -gem 'webauthn', '~> 3.0' +gem 'webauthn', '~> 2.3' # IPAddress utilities gem 'ipaddress', '~> 0.8.3' diff --git a/Gemfile.checksum b/Gemfile.checksum index 2545eb99a5e..592d11baac2 100644 --- a/Gemfile.checksum +++ b/Gemfile.checksum @@ -33,7 +33,7 @@ {"name":"attr_required","version":"1.0.1","platform":"ruby","checksum":"024e10393bd30901e1adf6769bd756b873a5ef7da60f86f8f11066116b5742bc"}, {"name":"autoprefixer-rails","version":"10.2.5.1","platform":"ruby","checksum":"3711d67f1112361c7628847ac192d8aa6f3b8abe47527aee8a69dc8985e798ee"}, {"name":"awesome_print","version":"1.9.2","platform":"ruby","checksum":"e99b32b704acff16d768b3468680793ced40bfdc4537eb07e06a4be11133786e"}, -{"name":"awrence","version":"1.2.1","platform":"ruby","checksum":"dd1d214c12a91f449d1ef81d7ee3babc2816944e450752e7522c65521872483e"}, +{"name":"awrence","version":"1.1.1","platform":"ruby","checksum":"9be584c97408ed92d5e1ca11740853646fe270de675f2f8dd44e8233226dfc97"}, {"name":"aws-eventstream","version":"1.2.0","platform":"ruby","checksum":"ffa53482c92880b001ff2fb06919b9bb82fd847cbb0fa244985d2ebb6dd0d1df"}, {"name":"aws-partitions","version":"1.703.0","platform":"ruby","checksum":"3d32fcdcb2799fe0472a9b30990035713d7a75ac8b77bd7767ef5ee2914ea748"}, {"name":"aws-sdk-cloudformation","version":"1.41.0","platform":"ruby","checksum":"31e47539719734413671edf9b1a31f8673fbf9688549f50c41affabbcb1c6b26"}, @@ -85,7 +85,7 @@ {"name":"concurrent-ruby","version":"1.2.0","platform":"ruby","checksum":"a5e799f71e7490f24a534d58c91380267d0ae306af0cdc518d6848b93475dae2"}, {"name":"connection_pool","version":"2.3.0","platform":"ruby","checksum":"677985be912f33c90f98f229aaa0c0ddb2ef8776f21929a36eeeb25251c944da"}, {"name":"cork","version":"0.3.0","platform":"ruby","checksum":"a0a0ac50e262f8514d1abe0a14e95e71c98b24e3378690e5d044daf0013ad4bc"}, -{"name":"cose","version":"1.3.0","platform":"ruby","checksum":"63247c66a5bc76e53926756574fe3724cc0a88707e358c90532ae2a320e98601"}, +{"name":"cose","version":"1.0.0","platform":"ruby","checksum":"520ebaad97b56d2873de02ff4e2c973f5e77ce2f8edbda454af9ee3073643bc0"}, {"name":"countries","version":"4.0.1","platform":"ruby","checksum":"d32e8a3c0b22949f1a41ea6d9005f5168ffce226f8fe077d1d6be785fffa81c5"}, {"name":"crack","version":"0.4.3","platform":"ruby","checksum":"5318ba8cd9cf7e0b5feb38948048503ba4b1fdc1b6ff30a39f0a00feb6036b29"}, {"name":"crass","version":"1.0.6","platform":"ruby","checksum":"dc516022a56e7b3b156099abc81b6d2b08ea1ed12676ac7a5657617f012bd45d"}, @@ -406,7 +406,7 @@ {"name":"open4","version":"1.3.4","platform":"ruby","checksum":"a1df037310624ecc1ea1d81264b11c83e96d0c3c1c6043108d37d396dcd0f4b1"}, {"name":"openid_connect","version":"1.3.0","platform":"ruby","checksum":"a796855096850cc01140e37ea6ae9fd14f2be818b9b5bc698418063dfe228770"}, {"name":"openssl","version":"2.2.2","platform":"ruby","checksum":"53f72382bac046c36c37049c7ec9d5597d42628d140b5cfbcd61e0226c0ca077"}, -{"name":"openssl-signature_algorithm","version":"1.3.0","platform":"ruby","checksum":"a3b40b5e8276162d4a6e50c7c97cdaf1446f9b2c3946a6fa2c14628e0c957e80"}, +{"name":"openssl-signature_algorithm","version":"0.4.0","platform":"ruby","checksum":"e53a225b773784935249cf4c61238c6cf0e1e464e78ae2f8ddaf995fb22ca991"}, {"name":"opentracing","version":"0.5.0","platform":"ruby","checksum":"deb5d7abe6b0e7631d866d8cb5ee7bb9352650a504a32f61591302bc510b9286"}, {"name":"optimist","version":"3.0.1","platform":"ruby","checksum":"336b753676d6117cad9301fac7e91dab4228f747d4e7179891ad3a163c64e2ed"}, {"name":"org-ruby","version":"0.9.12","platform":"ruby","checksum":"93cbec3a4470cb9dca6a4a98dc276a6434ea9d9e7bc2d42ea33c3aedd5d1c974"}, @@ -534,6 +534,7 @@ {"name":"sassc-rails","version":"2.1.0","platform":"ruby","checksum":"764dcc74e06930e3483caf0d595084d11f2b0fefd6539abf487cdddfba6cafa2"}, {"name":"sawyer","version":"0.9.2","platform":"ruby","checksum":"fa3a72d62a4525517b18857ddb78926aab3424de0129be6772a8e2ba240e7aca"}, {"name":"sd_notify","version":"0.1.1","platform":"ruby","checksum":"cbc7ac6caa7cedd26b30a72b5eeb6f36050dc0752df263452ea24fb5a4ad3131"}, +{"name":"securecompare","version":"1.0.0","platform":"ruby","checksum":"cb0c6599deaaedf6d28f8d88538b06e7198c4826b1b8edb1dbeb44a2162fc62b"}, {"name":"seed-fu","version":"2.3.7","platform":"ruby","checksum":"f19673443e9af799b730e3d4eca6a89b39e5a36825015dffd00d02ea3365cf74"}, {"name":"selenium-webdriver","version":"3.142.7","platform":"ruby","checksum":"dea0993e0e4fdb364f0453144814c0e6099a411d17396807c6cac666d0ddac29"}, {"name":"sentry-rails","version":"5.1.1","platform":"ruby","checksum":"906ef0a776ddc35884ab8b548856ba81c607e3fdee7c9c9f7c44efccc16a657f"}, @@ -608,7 +609,7 @@ {"name":"tins","version":"1.31.1","platform":"ruby","checksum":"51c4a347c25c630d310cbc2c040ffb84e266c8227f2ade881f1130ee4f9fbecf"}, {"name":"toml-rb","version":"2.2.0","platform":"ruby","checksum":"a1e2c54ac3cc9d49861004f75f0648b3622ac03a76abe105358c31553227d9a6"}, {"name":"tomlrb","version":"1.3.0","platform":"ruby","checksum":"68666bf53fa70ba686a48a7435ce7e086f5227c58c4c993bd9792f4760f2a503"}, -{"name":"tpm-key_attestation","version":"0.12.0","platform":"ruby","checksum":"e133d80cf24fef0e7a7dfad00fd6aeff01fc79875fbfc66cd8537bbd622b1e6d"}, +{"name":"tpm-key_attestation","version":"0.9.0","platform":"ruby","checksum":"e469ad9111a68dab4d04596e1c0621d7c877c2e3e247f765af3c04f1adf2b8cd"}, {"name":"trailblazer-option","version":"0.1.2","platform":"ruby","checksum":"20e4f12ea4e1f718c8007e7944ca21a329eee4eed9e0fa5dde6e8ad8ac4344a3"}, {"name":"train-core","version":"3.4.9","platform":"ruby","checksum":"d7ad8fa9a379c43a30baaaf1141af1cb28349d386c054f7fc81d169a625d6edd"}, {"name":"truncato","version":"0.7.12","platform":"ruby","checksum":"fed9e8a04fa35fd1a64506cd2089761bae4adfe47e756c3ce98a5c43856c9c4c"}, @@ -645,7 +646,7 @@ {"name":"vmstat","version":"2.3.0","platform":"ruby","checksum":"ab5446a3e3bd0a9cdb9d9ac69a0bbd119c4f161d945a0846a519dd7018af656d"}, {"name":"warden","version":"1.2.9","platform":"ruby","checksum":"46684f885d35a69dbb883deabf85a222c8e427a957804719e143005df7a1efd0"}, {"name":"warning","version":"1.3.0","platform":"ruby","checksum":"23695a5d8e50bd5c46068931b529bee0b28e4982cbcefbe77d867800dde8069e"}, -{"name":"webauthn","version":"3.0.0","platform":"ruby","checksum":"3f77d422c2a8a4b31e56cf42f83414bd066e0506e9896936e1730262dc4a20e6"}, +{"name":"webauthn","version":"2.3.0","platform":"ruby","checksum":"96fbee59f4a45219f1dae96f467b693de144f871be9ec6ea357168624dacd89e"}, {"name":"webfinger","version":"1.2.0","platform":"ruby","checksum":"7814ef1c85da47514f65c6e5ca14205fa9ce41ea2a70785e0c872842162852a2"}, {"name":"webmock","version":"3.9.1","platform":"ruby","checksum":"bcf6822456b234fb1bed2b0a89bff31fe0641214b44f6ba4ced2b824cf31337d"}, {"name":"webrick","version":"1.6.1","platform":"ruby","checksum":"0b4d1eab918f5f53333c690ad470825e51844ce9851e403a3fd47d6a84d9d67c"}, diff --git a/Gemfile.lock b/Gemfile.lock index d64be58596b..c8c2c775198 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -198,7 +198,7 @@ GEM autoprefixer-rails (10.2.5.1) execjs (> 0) awesome_print (1.9.2) - awrence (1.2.1) + awrence (1.1.1) aws-eventstream (1.2.0) aws-partitions (1.703.0) aws-sdk-cloudformation (1.41.0) @@ -298,9 +298,9 @@ GEM connection_pool (2.3.0) cork (0.3.0) colored2 (~> 3.1) - cose (1.3.0) + cose (1.0.0) cbor (~> 0.5.9) - openssl-signature_algorithm (~> 1.0) + openssl-signature_algorithm (~> 0.4.0) countries (4.0.1) i18n_data (~> 0.13.0) sixarm_ruby_unaccent (~> 1.1) @@ -1041,8 +1041,7 @@ GEM webfinger (>= 1.0.1) openssl (2.2.2) ipaddr - openssl-signature_algorithm (1.3.0) - openssl (> 2.0) + openssl-signature_algorithm (0.4.0) opentracing (0.5.0) optimist (3.0.1) org-ruby (0.9.12) @@ -1336,6 +1335,7 @@ GEM addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) sd_notify (0.1.1) + securecompare (1.0.0) seed-fu (2.3.7) activerecord (>= 3.1) activesupport (>= 3.1) @@ -1472,10 +1472,9 @@ GEM toml-rb (2.2.0) citrus (~> 3.0, > 3.0) tomlrb (1.3.0) - tpm-key_attestation (0.12.0) + tpm-key_attestation (0.9.0) bindata (~> 2.4) - openssl (> 2.0) - openssl-signature_algorithm (~> 1.0) + openssl-signature_algorithm (~> 0.4.0) trailblazer-option (0.1.2) train-core (3.4.9) addressable (~> 2.5) @@ -1548,15 +1547,16 @@ GEM warden (1.2.9) rack (>= 2.0.9) warning (1.3.0) - webauthn (3.0.0) + webauthn (2.3.0) android_key_attestation (~> 0.3.0) awrence (~> 1.1) bindata (~> 2.4) cbor (~> 0.5.9) - cose (~> 1.1) - openssl (>= 2.2) + cose (~> 1.0) + openssl (~> 2.0) safety_net_attestation (~> 0.4.0) - tpm-key_attestation (~> 0.12.0) + securecompare (~> 1.0) + tpm-key_attestation (~> 0.9.0) webfinger (1.2.0) activesupport httpclient (>= 2.4) @@ -1886,7 +1886,7 @@ DEPENDENCIES view_component (~> 2.74.1) vmstat (~> 2.3.0) warning (~> 1.3.0) - webauthn (~> 3.0) + webauthn (~> 2.3) webmock (~> 3.9.1) webrick (~> 1.6.1) wikicloth (= 0.8.1) diff --git a/app/assets/javascripts/ci/pipeline_editor/components/header/validation_segment.vue b/app/assets/javascripts/ci/pipeline_editor/components/header/validation_segment.vue index 68b5e00735a..8553256f13a 100644 --- a/app/assets/javascripts/ci/pipeline_editor/components/header/validation_segment.vue +++ b/app/assets/javascripts/ci/pipeline_editor/components/header/validation_segment.vue @@ -112,13 +112,11 @@ export default { {{ $options.i18n.loading }} - + diff --git a/app/assets/javascripts/saved_replies/components/form.vue b/app/assets/javascripts/saved_replies/components/form.vue index 932e7dcfa1f..8d2c3ce1685 100644 --- a/app/assets/javascripts/saved_replies/components/form.vue +++ b/app/assets/javascripts/saved_replies/components/form.vue @@ -1,11 +1,9 @@ diff --git a/app/assets/javascripts/saved_replies/queries/saved_replies.query.graphql b/app/assets/javascripts/saved_replies/queries/saved_replies.query.graphql index af1f12f3ceb..d8e76b5e2a8 100644 --- a/app/assets/javascripts/saved_replies/queries/saved_replies.query.graphql +++ b/app/assets/javascripts/saved_replies/queries/saved_replies.query.graphql @@ -1,7 +1,7 @@ -query savedReplies { +query savedReplies($after: String = "", $before: String = "") { currentUser { id - savedReplies { + savedReplies(after: $after, before: $before) { nodes { id name diff --git a/app/helpers/users/callouts_helper.rb b/app/helpers/users/callouts_helper.rb index d4603afb727..477f8c68379 100644 --- a/app/helpers/users/callouts_helper.rb +++ b/app/helpers/users/callouts_helper.rb @@ -60,17 +60,10 @@ module Users !user_dismissed?(SECURITY_NEWSLETTER_CALLOUT) end - def web_hook_disabled_dismissed?(project) - return false unless project - - last_failure = Gitlab::Redis::SharedState.with do |redis| - key = "web_hooks:last_failure:project-#{project.id}" - redis.get(key) - end + def web_hook_disabled_dismissed?(object) + return false unless object.class < WebHooks::HasWebHooks - last_failure = DateTime.parse(last_failure) if last_failure - - user_dismissed?(WEB_HOOK_DISABLED, last_failure, project: project) + user_dismissed?(WEB_HOOK_DISABLED, object.last_webhook_failure, object: object) end def show_merge_request_settings_callout?(project) @@ -84,22 +77,26 @@ module Users def ultimate_feature_removal_banner_dismissed?(project) return false unless project - user_dismissed?(ULTIMATE_FEATURE_REMOVAL_BANNER, project: project) + user_dismissed?(ULTIMATE_FEATURE_REMOVAL_BANNER, object: project) end private - def user_dismissed?(feature_name, ignore_dismissal_earlier_than = nil, project: nil) + def user_dismissed?(feature_name, ignore_dismissal_earlier_than = nil, object: nil) return false unless current_user query = { feature_name: feature_name, ignore_dismissal_earlier_than: ignore_dismissal_earlier_than } - if project - current_user.dismissed_callout_for_project?(project: project, **query) + if object + dismissed_callout?(object, query) else current_user.dismissed_callout?(**query) end end + + def dismissed_callout?(object, query) + current_user.dismissed_callout_for_project?(project: object, **query) + end end end diff --git a/app/helpers/web_hooks/web_hooks_helper.rb b/app/helpers/web_hooks/web_hooks_helper.rb index 514db6ba8a2..ad792f761f8 100644 --- a/app/helpers/web_hooks/web_hooks_helper.rb +++ b/app/helpers/web_hooks/web_hooks_helper.rb @@ -4,19 +4,31 @@ module WebHooks module WebHooksHelper def show_project_hook_failed_callout?(project:) return false if project_hook_page? + + show_hook_failed_callout?(project) + end + + private + + def show_hook_failed_callout?(object) return false unless current_user - return false unless Ability.allowed?(current_user, :read_web_hooks, project) + + return false unless can_access_web_hooks?(object) # Assumes include of Users::CalloutsHelper - return false if web_hook_disabled_dismissed?(project) + return false if web_hook_disabled_dismissed?(object) - project.fetch_web_hook_failure + object.fetch_web_hook_failure end - private - def project_hook_page? current_controller?('projects/hooks') || current_controller?('projects/hook_logs') end + + def can_access_web_hooks?(object) + Ability.allowed?(current_user, :admin_project, object) + end end end + +WebHooks::WebHooksHelper.prepend_mod diff --git a/app/models/ci/runner_machine.rb b/app/models/ci/runner_machine.rb index ac892b3304f..68c3636ca9d 100644 --- a/app/models/ci/runner_machine.rb +++ b/app/models/ci/runner_machine.rb @@ -5,9 +5,6 @@ module Ci include FromUnion include RedisCacheable include Ci::HasRunnerExecutor - include IgnorableColumns - - ignore_column :machine_xid, remove_with: '15.11', remove_after: '2022-03-22' # The `UPDATE_CONTACT_COLUMN_EVERY` defines how often the Runner Machine DB entry can be updated UPDATE_CONTACT_COLUMN_EVERY = (40.minutes)..(55.minutes) diff --git a/app/models/concerns/web_hooks/has_web_hooks.rb b/app/models/concerns/web_hooks/has_web_hooks.rb index 161ce106b9b..2183cc3c44b 100644 --- a/app/models/concerns/web_hooks/has_web_hooks.rb +++ b/app/models/concerns/web_hooks/has_web_hooks.rb @@ -2,8 +2,6 @@ module WebHooks module HasWebHooks - extend ActiveSupport::Concern - WEB_HOOK_CACHE_EXPIRY = 1.hour def any_hook_failed? @@ -15,7 +13,7 @@ module WebHooks end def last_failure_redis_key - "web_hooks:last_failure:project-#{id}" + "web_hooks:last_failure:#{self.class.name.underscore}-#{id}" end def get_web_hook_failure @@ -42,5 +40,13 @@ module WebHooks state end end + + def last_webhook_failure + last_failure = Gitlab::Redis::SharedState.with do |redis| + redis.get(last_failure_redis_key) + end + + DateTime.parse(last_failure) if last_failure + end end end diff --git a/app/models/project.rb b/app/models/project.rb index ae4cedb5af3..a26116ee830 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -19,6 +19,7 @@ class Project < ApplicationRecord include Presentable include HasRepository include HasWiki + include WebHooks::HasWebHooks include CanMoveRepositoryStorage include Routable include GroupDescendant @@ -41,7 +42,6 @@ class Project < ApplicationRecord include BlocksUnsafeSerialization include Subquery include IssueParent - include WebHooks::HasWebHooks extend Gitlab::Cache::RequestCache extend Gitlab::Utils::Override diff --git a/app/models/users/group_callout.rb b/app/models/users/group_callout.rb index 2552407fa4c..1e2afdc28d5 100644 --- a/app/models/users/group_callout.rb +++ b/app/models/users/group_callout.rb @@ -24,7 +24,8 @@ module Users namespace_storage_limit_banner_error_threshold: 13, # EE-only usage_quota_trial_alert: 14, # EE-only preview_usage_quota_free_plan_alert: 15, # EE-only - enforcement_at_limit_alert: 16 # EE-only + enforcement_at_limit_alert: 16, # EE-only + web_hook_disabled: 17 # EE-only } validates :group, presence: true diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index 2cbe9ad83cc..1d635b45207 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -531,7 +531,6 @@ class ProjectPolicy < BasePolicy enable :update_runners_registration_token enable :admin_project_google_cloud enable :admin_secure_files - enable :read_web_hooks enable :read_upload enable :destroy_upload enable :admin_incident_management_timeline_event_tag diff --git a/app/views/layouts/group.html.haml b/app/views/layouts/group.html.haml index 95934f43a51..28579c7f7ea 100644 --- a/app/views/layouts/group.html.haml +++ b/app/views/layouts/group.html.haml @@ -16,6 +16,7 @@ :plain window.uploads_path = "#{group_uploads_path(@group)}"; += dispensable_render_if_exists "shared/web_hooks/group_web_hook_disabled_alert" = dispensable_render_if_exists "shared/free_user_cap_alert", source: @group = render template: base_layout || "layouts/application" diff --git a/db/post_migrate/20221102231130_finalize_backfill_user_details_fields.rb b/db/post_migrate/20221102231130_finalize_backfill_user_details_fields.rb new file mode 100644 index 00000000000..0ce8f260d06 --- /dev/null +++ b/db/post_migrate/20221102231130_finalize_backfill_user_details_fields.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class FinalizeBackfillUserDetailsFields < Gitlab::Database::Migration[2.0] + BACKFILL_MIGRATION = 'BackfillUserDetailsFields' + + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + ensure_batched_background_migration_is_finished( + job_class_name: BACKFILL_MIGRATION, + table_name: :users, + column_name: :id, + job_arguments: [], + finalize: true) + end + + def down; end +end diff --git a/db/post_migrate/20221102231131_remove_temp_index_for_user_details_fields.rb b/db/post_migrate/20221102231131_remove_temp_index_for_user_details_fields.rb index 340d1205ef7..c31513e00fc 100644 --- a/db/post_migrate/20221102231131_remove_temp_index_for_user_details_fields.rb +++ b/db/post_migrate/20221102231131_remove_temp_index_for_user_details_fields.rb @@ -1,13 +1,11 @@ # frozen_string_literal: true class RemoveTempIndexForUserDetailsFields < Gitlab::Database::Migration[2.0] - BACKFILL_MIGRATION = 'BackfillUserDetailsFields' INDEX_NAME = 'tmp_idx_where_user_details_fields_filled' disable_ddl_transaction! def up - finalize_background_migration BACKFILL_MIGRATION remove_concurrent_index_by_name :users, INDEX_NAME end diff --git a/db/schema_migrations/20221102231130 b/db/schema_migrations/20221102231130 new file mode 100644 index 00000000000..ee01f627eef --- /dev/null +++ b/db/schema_migrations/20221102231130 @@ -0,0 +1 @@ +8678040a9fa8da1d455489db89e00084943d1dced6dd01cbf3517afd1a47bac5 \ No newline at end of file diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index d27c158e3e7..884b4d11b96 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -19514,6 +19514,7 @@ Protected Environments of the environment. | `group` | [`Group`](#group) | Group details. Present if it's group-level protected environment. | | `name` | [`String`](#string) | Name of the environment if it's a project-level protected environment. Tier of the environment if it's a group-level protected environment. | | `project` | [`Project`](#project) | Project details. Present if it's project-level protected environment. | +| `requiredApprovalCount` | [`Int`](#int) | Required approval count for Unified Approval Setting. | ### `ProtectedEnvironmentApprovalRule` diff --git a/doc/development/service_ping/implement.md b/doc/development/service_ping/implement.md index d8bb00dc43a..306ffa5d6e7 100644 --- a/doc/development/service_ping/implement.md +++ b/doc/development/service_ping/implement.md @@ -330,7 +330,6 @@ Implemented using Redis methods [PFADD](https://redis.io/commands/pfadd/) and [P ```yaml - name: users_creating_epics - category: epics_usage redis_slot: users aggregation: weekly ``` @@ -343,12 +342,8 @@ Implemented using Redis methods [PFADD](https://redis.io/commands/pfadd/) and [P [See Metric name](metrics_dictionary.md#metric-name) for a complete guide on metric naming suggestion. - Consider including in the event's name the Redis slot to be able to count totals for a specific category. - Example names: `users_creating_epics`, `users_triggering_security_scans`. - - `category`: event category. Used for getting total counts for events in a category, for easier - access to a group of events. - `redis_slot`: optional Redis slot. Default value: event name. Only event data that is stored in the same slot can be aggregated. Ensure keys are in the same slot. For example: `users_creating_epics` with `redis_slot: 'users'` builds Redis key @@ -533,16 +528,6 @@ For each event we add metrics for the weekly and monthly time frames, and totals - `#{event_name}_weekly`: Data for 7 days for daily [aggregation](#add-new-events) events and data for the last complete week for weekly [aggregation](#add-new-events) events. - `#{event_name}_monthly`: Data for 28 days for daily [aggregation](#add-new-events) events and data for the last 4 complete weeks for weekly [aggregation](#add-new-events) events. -Redis HLL implementation calculates total metrics when both of these conditions are met: - -- The category is manually included in [CATEGORIES_FOR_TOTALS](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/usage_data_counters/hll_redis_counter.rb#L21). -- There is more than one metric for the same category, aggregation, and Redis slot. - -We add total unique counts for the weekly and monthly time frames where applicable: - -- `#{category}_total_unique_counts_weekly`: Total unique counts for events in the same category for the last 7 days or the last complete week, if events are in the same Redis slot and we have more than one metric. -- `#{category}_total_unique_counts_monthly`: Total unique counts for events in same category for the last 28 days or the last 4 complete weeks, if events are in the same Redis slot and we have more than one metric. - Example of `redis_hll_counters` data: ```ruby @@ -567,6 +552,7 @@ Example of `redis_hll_counters` data: "ide_edit_total_unique_counts_weekly"=>0, "ide_edit_total_unique_counts_monthly"=>0} } +} ``` Example: diff --git a/lib/gitlab/usage/metrics/aggregates/aggregate.rb b/lib/gitlab/usage/metrics/aggregates/aggregate.rb index b68e1ace658..a0a58534661 100644 --- a/lib/gitlab/usage/metrics/aggregates/aggregate.rb +++ b/lib/gitlab/usage/metrics/aggregates/aggregate.rb @@ -7,11 +7,6 @@ module Gitlab class Aggregate include Gitlab::Usage::TimeFrame - # TODO: define this missing event https://gitlab.com/gitlab-org/gitlab/-/issues/385080 - EVENTS_NOT_DEFINED_YET = %w[ - i_code_review_merge_request_widget_license_compliance_warning - ].freeze - def initialize(recorded_at) @recorded_at = recorded_at end @@ -84,7 +79,7 @@ module Gitlab return events if source != ::Gitlab::Usage::Metrics::Aggregates::REDIS_SOURCE events.select do |event| - ::Gitlab::UsageDataCounters::HLLRedisCounter.known_event?(event) || EVENTS_NOT_DEFINED_YET.include?(event) + ::Gitlab::UsageDataCounters::HLLRedisCounter.known_event?(event) end end end diff --git a/lib/gitlab/usage_data_counters/hll_redis_counter.rb b/lib/gitlab/usage_data_counters/hll_redis_counter.rb index b809e6c4e42..8d170a9412a 100644 --- a/lib/gitlab/usage_data_counters/hll_redis_counter.rb +++ b/lib/gitlab/usage_data_counters/hll_redis_counter.rb @@ -12,19 +12,11 @@ module Gitlab UnknownAggregation = Class.new(EventError) AggregationMismatch = Class.new(EventError) SlotMismatch = Class.new(EventError) - CategoryMismatch = Class.new(EventError) InvalidContext = Class.new(EventError) KNOWN_EVENTS_PATH = File.expand_path('known_events/*.yml', __dir__) ALLOWED_AGGREGATIONS = %i(daily weekly).freeze - CATEGORIES_FOR_TOTALS = %w[ - compliance - error_tracking - ide_edit - pipeline_authoring - ].freeze - # Track event on entity_id # Increment a Redis HLL counter for unique event_name and entity_id # @@ -34,7 +26,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 # aggregation: daily # Aggregation level, keys are stored daily or weekly # feature_flag: # The event feature flag # @@ -77,22 +68,11 @@ module Gitlab def unique_events(event_names:, start_date:, end_date:, context: '') count_unique_events(event_names: event_names, start_date: start_date, end_date: end_date, context: context) do |events| raise SlotMismatch, events unless events_in_same_slot?(events) - raise CategoryMismatch, events unless events_in_same_category?(events) raise AggregationMismatch, events unless events_same_aggregation?(events) raise InvalidContext if context.present? && !context.in?(valid_context_list) end end - def categories - @categories ||= known_events.map { |event| event[:category] }.uniq - end - - # @param category [String] the category name - # @return [Array] list of event names for given category - def events_for_category(category) - known_events.select { |event| event[:category] == category.to_s }.map { |event| event[:name] } - end - def known_event?(event_name) event_for(event_name).present? end @@ -151,15 +131,6 @@ module Gitlab Feature.enabled?(event[:feature_flag]) && Feature.enabled?(:redis_hll_tracking, type: :ops) end - # Allow to add totals for events that are in the same redis slot, category and have the same aggregation level - # and if there are more than 1 event - def eligible_for_totals?(events_names) - return false if events_names.size <= 1 - - events = events_for(events_names) - events_in_same_slot?(events) && events_in_same_category?(events) && events_same_aggregation?(events) - end - def keys_for_aggregation(aggregation, events:, start_date:, end_date:, context: '') if aggregation.to_sym == :daily daily_redis_keys(events: events, start_date: start_date, end_date: end_date, context: context) @@ -191,11 +162,6 @@ module Gitlab events.all? { |event| event[:redis_slot].present? && event[:redis_slot] == slot } end - def events_in_same_category?(events) - category = events.first[:category] - events.all? { |event| event[:category] == category } - end - def events_same_aggregation?(events) aggregation = events.first[:aggregation] events.all? { |event| event[:aggregation] == aggregation } diff --git a/lib/gitlab/usage_data_counters/known_events/analytics.yml b/lib/gitlab/usage_data_counters/known_events/analytics.yml index 85524c766ca..1c390f2d7fd 100644 --- a/lib/gitlab/usage_data_counters/known_events/analytics.yml +++ b/lib/gitlab/usage_data_counters/known_events/analytics.yml @@ -1,52 +1,39 @@ - name: users_viewing_analytics_group_devops_adoption - category: analytics redis_slot: analytics aggregation: weekly - name: i_analytics_dev_ops_adoption - category: analytics redis_slot: analytics aggregation: weekly - name: i_analytics_dev_ops_score - category: analytics redis_slot: analytics aggregation: weekly - name: i_analytics_instance_statistics - category: analytics redis_slot: analytics aggregation: weekly - name: p_analytics_pipelines - category: analytics redis_slot: analytics aggregation: weekly - name: p_analytics_valuestream - category: analytics redis_slot: analytics aggregation: weekly - name: p_analytics_repo - category: analytics redis_slot: analytics aggregation: weekly - name: i_analytics_cohorts - category: analytics redis_slot: analytics aggregation: weekly - name: p_analytics_ci_cd_pipelines - category: analytics redis_slot: analytics aggregation: weekly - name: p_analytics_ci_cd_deployment_frequency - category: analytics redis_slot: analytics aggregation: weekly - name: p_analytics_ci_cd_lead_time - category: analytics redis_slot: analytics aggregation: weekly - name: p_analytics_ci_cd_time_to_restore_service - category: analytics redis_slot: analytics aggregation: weekly - name: p_analytics_ci_cd_change_failure_rate - category: analytics redis_slot: analytics aggregation: weekly 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 1731e376b31..66a31e97d9e 100644 --- a/lib/gitlab/usage_data_counters/known_events/ci_templates.yml +++ b/lib/gitlab/usage_data_counters/known_events/ci_templates.yml @@ -4,155 +4,117 @@ # Do not edit it manually! --- - name: p_ci_templates_terraform_base_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_terraform_base - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_dotnet - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_nodejs - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_openshift - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_auto_devops - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_bash - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_rust - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_elixir - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_clojure - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_crystal - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_getting_started - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_code_quality - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_verify_load_performance_testing - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_verify_accessibility - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_verify_failfast - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_verify_browser_performance - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_verify_browser_performance_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_grails - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_sast - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_dast_runner_validation - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_dast_on_demand_scan - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_secret_detection - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_license_scanning - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_coverage_fuzzing_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_dast_on_demand_api_scan - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_coverage_fuzzing - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_api_fuzzing_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_secure_binaries - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_dast_api - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_container_scanning - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_dast_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_sast_iac - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_dependency_scanning - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_dast_api_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_container_scanning_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_api_fuzzing - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_dast - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_api_discovery @@ -160,443 +122,333 @@ redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_fortify_fod_sast - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_security_sast_iac_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_qualys_iac_security - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_ios_fastlane - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_composer - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_c - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_python - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_android_fastlane - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_android_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_django - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_maven - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_liquibase - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_flutter - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_workflows_branch_pipelines - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_workflows_mergerequest_pipelines - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_laravel - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_kaniko - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_php - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_packer - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_themekit - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_terraform - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_katalon - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_mono - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_go - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_scala - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_latex - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_android - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_indeni_cloudrail - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_matlab - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_deploy_ecs - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_aws_cf_provision_and_deploy_ec2 - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_aws_deploy_ecs - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_gradle - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_chef - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_dast_default_branch_deploy - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_load_performance_testing - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_helm_2to3 - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_sast - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_secret_detection - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_license_scanning - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_code_intelligence - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_code_quality - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_deploy_ecs - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_deploy_ec2 - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_license_scanning_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_deploy - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_build - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_browser_performance_testing - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_container_scanning - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_container_scanning_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_dependency_scanning_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_test - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_sast_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_sast_iac - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_secret_detection_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_dependency_scanning - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_deploy_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_browser_performance_testing_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_cf_provision - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_build_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_jobs_sast_iac_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_terraform_latest - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_swift - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_jekyll - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_harp - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_octopress - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_brunch - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_doxygen - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_hyde - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_lektor - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_jbake - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_hexo - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_middleman - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_hugo - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_pelican - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_nanoc - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_swaggerui - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_jigsaw - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_metalsmith - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_gatsby - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_pages_html - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_dart - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_docker - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_julia - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_npm - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_dotnet_core - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_5_minute_production_app - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_ruby - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_auto_devops - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_browser_performance_testing - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_build - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_code_intelligence - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_code_quality - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_container_scanning - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_dast_default_branch_deploy - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_dependency_scanning - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_deploy - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_deploy_ec2 - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_deploy_ecs - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_helm_2to3 - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_license_scanning - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_sast - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_secret_detection - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_jobs_test - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_security_container_scanning - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_security_dast - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_security_dependency_scanning - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_security_license_scanning - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_security_sast - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_implicit_security_secret_detection - category: ci_templates redis_slot: ci_templates aggregation: weekly - name: p_ci_templates_terraform_module_base diff --git a/lib/gitlab/usage_data_counters/known_events/ci_users.yml b/lib/gitlab/usage_data_counters/known_events/ci_users.yml index 465ac6c3f0b..6db10366b83 100644 --- a/lib/gitlab/usage_data_counters/known_events/ci_users.yml +++ b/lib/gitlab/usage_data_counters/known_events/ci_users.yml @@ -1,8 +1,6 @@ - name: ci_users_executing_deployment_job - category: ci_users redis_slot: ci_users aggregation: weekly - name: ci_users_executing_verify_environment_job - category: ci_users redis_slot: ci_users aggregation: weekly diff --git a/lib/gitlab/usage_data_counters/known_events/code_review_events.yml b/lib/gitlab/usage_data_counters/known_events/code_review_events.yml index 3bb6655d762..f64da801c39 100644 --- a/lib/gitlab/usage_data_counters/known_events/code_review_events.yml +++ b/lib/gitlab/usage_data_counters/known_events/code_review_events.yml @@ -1,457 +1,345 @@ --- - name: i_code_review_create_note_in_ipynb_diff redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_create_note_in_ipynb_diff_mr redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_create_note_in_ipynb_diff_commit redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_create_note_in_ipynb_diff redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_create_note_in_ipynb_diff_mr redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_create_note_in_ipynb_diff_commit redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_mr_diffs redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_single_file_diffs redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_mr_single_file_diffs redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_toggled_task_item_status redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_create_mr redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_create_mr redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_close_mr redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_reopen_mr redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_approve_mr redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_unapprove_mr redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_resolve_thread redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_unresolve_thread redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_edit_mr_title redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_edit_mr_desc redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_merge_mr redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_create_mr_comment redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_edit_mr_comment redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_remove_mr_comment redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_create_review_note redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_publish_review redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_create_multiline_mr_comment redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_edit_multiline_mr_comment redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_remove_multiline_mr_comment redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_add_suggestion redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_apply_suggestion redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_assigned redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_marked_as_draft redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_unmarked_as_draft redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_review_requested redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_approval_rule_added redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_approval_rule_deleted redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_approval_rule_edited redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_vs_code_api_request redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_jetbrains_api_request redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_gitlab_cli_api_request redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_create_mr_from_issue redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_mr_discussion_locked redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_mr_discussion_unlocked redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_time_estimate_changed redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_time_spent_changed redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_assignees_changed redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_reviewers_changed redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_milestone_changed redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_labels_changed redis_slot: code_review - category: code_review aggregation: weekly # Diff settings events - name: i_code_review_click_diff_view_setting redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_click_single_file_mode_setting redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_click_file_browser_setting redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_click_whitespace_setting redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_diff_view_inline redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_diff_view_parallel redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_file_browser_tree_view redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_file_browser_list_view redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_diff_show_whitespace redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_diff_hide_whitespace redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_diff_single_file redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_diff_multiple_files redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_load_conflict_ui redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_resolve_conflict redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_searches_diff redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_total_suggestions_applied redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_total_suggestions_added redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_user_resolve_thread_in_issue redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_widget_nothing_merge_click_new_file redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_post_merge_delete_branch redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_post_merge_click_revert redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_post_merge_click_cherry_pick redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_post_merge_submit_revert_modal redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_post_merge_submit_cherry_pick_modal redis_slot: code_review - category: code_review aggregation: weekly # MR Widget Extensions ## Test Summary - name: i_code_review_merge_request_widget_test_summary_view redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_test_summary_full_report_clicked redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_test_summary_expand redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_test_summary_expand_success redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_test_summary_expand_warning redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_test_summary_expand_failed redis_slot: code_review - category: code_review aggregation: weekly ## Accessibility - name: i_code_review_merge_request_widget_accessibility_view redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_accessibility_full_report_clicked redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_accessibility_expand redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_accessibility_expand_success redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_accessibility_expand_warning redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_accessibility_expand_failed redis_slot: code_review - category: code_review aggregation: weekly ## Code Quality - name: i_code_review_merge_request_widget_code_quality_view redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_code_quality_full_report_clicked redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_code_quality_expand redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_code_quality_expand_success redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_code_quality_expand_warning redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_code_quality_expand_failed redis_slot: code_review - category: code_review aggregation: weekly ## Terraform - name: i_code_review_merge_request_widget_terraform_view redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_terraform_full_report_clicked redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_terraform_expand redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_terraform_expand_success redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_terraform_expand_warning redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_terraform_expand_failed redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_submit_review_approve redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_submit_review_comment redis_slot: code_review - category: code_review aggregation: weekly ## License Compliance - name: i_code_review_merge_request_widget_license_compliance_view redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_license_compliance_full_report_clicked redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_license_compliance_expand redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_license_compliance_expand_success redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_license_compliance_expand_warning redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_license_compliance_expand_failed redis_slot: code_review - category: code_review aggregation: weekly ## Security Reports - name: i_code_review_merge_request_widget_security_reports_view redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_security_reports_full_report_clicked redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_security_reports_expand redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_security_reports_expand_success redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_security_reports_expand_warning redis_slot: code_review - category: code_review aggregation: weekly - name: i_code_review_merge_request_widget_security_reports_expand_failed redis_slot: code_review - category: code_review 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 ae15530f0d0..433bfae4a0a 100644 --- a/lib/gitlab/usage_data_counters/known_events/common.yml +++ b/lib/gitlab/usage_data_counters/known_events/common.yml @@ -1,243 +1,183 @@ --- # Compliance category - name: g_edit_by_web_ide - category: ide_edit redis_slot: edit aggregation: daily - name: g_edit_by_sfe - category: ide_edit redis_slot: edit aggregation: daily - name: g_edit_by_snippet_ide - category: ide_edit redis_slot: edit aggregation: daily - name: g_edit_by_live_preview - category: ide_edit redis_slot: edit aggregation: daily - name: i_search_total - category: search redis_slot: search aggregation: weekly - name: wiki_action - category: source_code aggregation: daily - name: design_action - category: source_code aggregation: daily - name: project_action - category: source_code aggregation: daily - name: git_write_action - category: source_code aggregation: daily - name: merge_request_action - category: source_code aggregation: daily - name: i_source_code_code_intelligence redis_slot: source_code - category: source_code aggregation: daily # Incident management - name: incident_management_alert_status_changed redis_slot: incident_management - category: incident_management aggregation: weekly - name: incident_management_alert_assigned redis_slot: incident_management - category: incident_management aggregation: weekly - name: incident_management_alert_todo redis_slot: incident_management - category: incident_management aggregation: weekly - name: incident_management_incident_created redis_slot: incident_management - category: incident_management aggregation: weekly - name: incident_management_incident_reopened redis_slot: incident_management - category: incident_management aggregation: weekly - name: incident_management_incident_closed redis_slot: incident_management - category: incident_management aggregation: weekly - name: incident_management_incident_assigned redis_slot: incident_management - category: incident_management aggregation: weekly - name: incident_management_incident_todo redis_slot: incident_management - category: incident_management aggregation: weekly - name: incident_management_incident_comment redis_slot: incident_management - category: incident_management aggregation: weekly - name: incident_management_incident_zoom_meeting redis_slot: incident_management - category: incident_management aggregation: weekly - name: incident_management_incident_relate redis_slot: incident_management - category: incident_management aggregation: weekly - name: incident_management_incident_unrelate redis_slot: incident_management - category: incident_management aggregation: weekly - name: incident_management_incident_change_confidential redis_slot: incident_management - category: incident_management aggregation: weekly # Incident management timeline events - name: incident_management_timeline_event_created redis_slot: incident_management - category: incident_management aggregation: weekly - name: incident_management_timeline_event_edited redis_slot: incident_management - category: incident_management aggregation: weekly - name: incident_management_timeline_event_deleted redis_slot: incident_management - category: incident_management aggregation: weekly # Incident management alerts - name: incident_management_alert_create_incident redis_slot: incident_management - category: incident_management_alerts aggregation: weekly # Testing category - name: i_testing_test_case_parsed - category: testing redis_slot: testing aggregation: weekly - name: i_testing_summary_widget_total - category: testing redis_slot: testing aggregation: weekly - name: i_testing_test_report_uploaded - category: testing redis_slot: testing aggregation: weekly - name: i_testing_coverage_report_uploaded - category: testing redis_slot: testing aggregation: weekly # Project Management group - name: g_project_management_issue_title_changed - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_description_changed - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_assignee_changed - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_made_confidential - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_made_visible - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_created - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_closed - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_reopened - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_label_changed - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_milestone_changed - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_cross_referenced - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_moved - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_related - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_unrelated - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_marked_as_duplicate - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_locked - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_unlocked - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_designs_added - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_designs_modified - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_designs_removed - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_due_date_changed - 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 aggregation: daily - name: g_project_management_issue_time_spent_changed - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_comment_added - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_comment_edited - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_comment_removed - category: issues_edit redis_slot: project_management aggregation: daily - name: g_project_management_issue_cloned - category: issues_edit redis_slot: project_management aggregation: daily # Runner group @@ -247,67 +187,52 @@ aggregation: weekly # Secrets Management - name: i_snippets_show - category: snippets redis_slot: snippets aggregation: weekly # Terraform - name: p_terraform_state_api_unique_users - category: terraform redis_slot: terraform aggregation: weekly # Pipeline Authoring group - name: o_pipeline_authoring_unique_users_committing_ciconfigfile - category: pipeline_authoring redis_slot: pipeline_authoring aggregation: weekly - name: o_pipeline_authoring_unique_users_pushing_mr_ciconfigfile - 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 - category: secure aggregation: weekly - name: users_expanding_testing_code_quality_report redis_slot: testing - category: testing aggregation: weekly - name: users_expanding_testing_accessibility_report redis_slot: testing - category: testing aggregation: weekly - name: users_expanding_testing_license_compliance_report redis_slot: testing - category: testing aggregation: weekly - name: users_visiting_testing_license_compliance_full_report redis_slot: testing - category: testing aggregation: weekly - name: users_visiting_testing_manage_license_compliance redis_slot: testing - category: testing aggregation: weekly - name: users_clicking_license_testing_visiting_external_website redis_slot: testing - category: testing aggregation: weekly # Geo group - name: g_geo_proxied_requests - category: geo redis_slot: geo aggregation: daily # Manage - name: unique_active_user - category: manage aggregation: weekly # Environments page - name: users_visiting_environments_pages - category: environments redis_slot: users aggregation: weekly diff --git a/lib/gitlab/usage_data_counters/known_events/ecosystem.yml b/lib/gitlab/usage_data_counters/known_events/ecosystem.yml index 7f7c9166086..03bbba663c5 100644 --- a/lib/gitlab/usage_data_counters/known_events/ecosystem.yml +++ b/lib/gitlab/usage_data_counters/known_events/ecosystem.yml @@ -1,46 +1,35 @@ --- # Ecosystem category - name: i_ecosystem_jira_service_close_issue - category: ecosystem redis_slot: ecosystem aggregation: weekly - name: i_ecosystem_jira_service_cross_reference - category: ecosystem redis_slot: ecosystem aggregation: weekly - name: i_ecosystem_slack_service_issue_notification - category: ecosystem redis_slot: ecosystem aggregation: weekly - name: i_ecosystem_slack_service_push_notification - category: ecosystem redis_slot: ecosystem aggregation: weekly - name: i_ecosystem_slack_service_deployment_notification - category: ecosystem redis_slot: ecosystem aggregation: weekly - name: i_ecosystem_slack_service_wiki_page_notification - category: ecosystem redis_slot: ecosystem aggregation: weekly - name: i_ecosystem_slack_service_merge_request_notification - category: ecosystem redis_slot: ecosystem aggregation: weekly - name: i_ecosystem_slack_service_note_notification - category: ecosystem redis_slot: ecosystem aggregation: weekly - name: i_ecosystem_slack_service_tag_push_notification - category: ecosystem redis_slot: ecosystem aggregation: weekly - name: i_ecosystem_slack_service_confidential_note_notification - category: ecosystem redis_slot: ecosystem aggregation: weekly - name: i_ecosystem_slack_service_confidential_issue_notification - category: ecosystem redis_slot: ecosystem aggregation: weekly diff --git a/lib/gitlab/usage_data_counters/known_events/error_tracking.yml b/lib/gitlab/usage_data_counters/known_events/error_tracking.yml index d80b711f8eb..efed16c11f8 100644 --- a/lib/gitlab/usage_data_counters/known_events/error_tracking.yml +++ b/lib/gitlab/usage_data_counters/known_events/error_tracking.yml @@ -1,9 +1,7 @@ --- - name: error_tracking_view_details - category: error_tracking redis_slot: error_tracking aggregation: weekly - name: error_tracking_view_list - category: error_tracking redis_slot: error_tracking aggregation: weekly diff --git a/lib/gitlab/usage_data_counters/known_events/importer_events.yml b/lib/gitlab/usage_data_counters/known_events/importer_events.yml index c84d756a013..ece8cd6aa45 100644 --- a/lib/gitlab/usage_data_counters/known_events/importer_events.yml +++ b/lib/gitlab/usage_data_counters/known_events/importer_events.yml @@ -1,14 +1,11 @@ --- # Importer events - name: github_import_project_start - category: importer redis_slot: import aggregation: weekly - name: github_import_project_success - category: importer redis_slot: import aggregation: weekly - name: github_import_project_failure - category: importer redis_slot: import aggregation: weekly diff --git a/lib/gitlab/usage_data_counters/known_events/kubernetes_agent.yml b/lib/gitlab/usage_data_counters/known_events/kubernetes_agent.yml index 966e6c584c7..9703c022ef5 100644 --- a/lib/gitlab/usage_data_counters/known_events/kubernetes_agent.yml +++ b/lib/gitlab/usage_data_counters/known_events/kubernetes_agent.yml @@ -1,4 +1,3 @@ - name: agent_users_using_ci_tunnel - category: kubernetes_agent redis_slot: agent aggregation: weekly diff --git a/lib/gitlab/usage_data_counters/known_events/package_events.yml b/lib/gitlab/usage_data_counters/known_events/package_events.yml index ef8d02fa365..d9797635240 100644 --- a/lib/gitlab/usage_data_counters/known_events/package_events.yml +++ b/lib/gitlab/usage_data_counters/known_events/package_events.yml @@ -1,89 +1,67 @@ --- - name: i_package_composer_deploy_token - category: deploy_token_packages aggregation: weekly redis_slot: package - name: i_package_composer_user - category: user_packages aggregation: weekly redis_slot: package - name: i_package_conan_deploy_token - category: deploy_token_packages aggregation: weekly redis_slot: package - name: i_package_conan_user - category: user_packages aggregation: weekly redis_slot: package - name: i_package_generic_deploy_token - category: deploy_token_packages aggregation: weekly redis_slot: package - name: i_package_generic_user - category: user_packages aggregation: weekly redis_slot: package - name: i_package_helm_deploy_token - category: deploy_token_packages aggregation: weekly redis_slot: package - name: i_package_helm_user - category: user_packages aggregation: weekly redis_slot: package - name: i_package_maven_deploy_token - category: deploy_token_packages aggregation: weekly redis_slot: package - name: i_package_maven_user - category: user_packages aggregation: weekly redis_slot: package - name: i_package_npm_deploy_token - category: deploy_token_packages aggregation: weekly redis_slot: package - name: i_package_npm_user - category: user_packages aggregation: weekly redis_slot: package - name: i_package_nuget_deploy_token - category: deploy_token_packages aggregation: weekly redis_slot: package - name: i_package_nuget_user - category: user_packages aggregation: weekly redis_slot: package - name: i_package_pypi_deploy_token - category: deploy_token_packages aggregation: weekly redis_slot: package - name: i_package_pypi_user - category: user_packages aggregation: weekly redis_slot: package - name: i_package_rubygems_deploy_token - category: deploy_token_packages aggregation: weekly redis_slot: package - name: i_package_rubygems_user - category: user_packages aggregation: weekly redis_slot: package - name: i_package_terraform_module_deploy_token - category: deploy_token_packages aggregation: weekly redis_slot: package - name: i_package_terraform_module_user - category: user_packages aggregation: weekly redis_slot: package - name: i_package_rpm_user - category: user_packages aggregation: weekly redis_slot: package - name: i_package_rpm_deploy_token - category: deploy_token_packages aggregation: weekly redis_slot: package diff --git a/lib/gitlab/usage_data_counters/known_events/quickactions.yml b/lib/gitlab/usage_data_counters/known_events/quickactions.yml index 69b348b9a22..306ed79ea23 100644 --- a/lib/gitlab/usage_data_counters/known_events/quickactions.yml +++ b/lib/gitlab/usage_data_counters/known_events/quickactions.yml @@ -1,253 +1,190 @@ --- - name: i_quickactions_assign_multiple - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_approve - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_unapprove - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_assign_single - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_assign_self - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_assign_reviewer - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_award - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_board_move - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_clone - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_close - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_confidential - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_copy_metadata_merge_request - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_copy_metadata_issue - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_create_merge_request - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_done - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_draft - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_due - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_duplicate - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_estimate - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_label - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_lock - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_merge - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_milestone - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_move - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_promote_to_incident - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_timeline - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_ready - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_reassign - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_reassign_reviewer - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_rebase - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_relabel - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_relate - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_remove_due_date - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_remove_estimate - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_remove_milestone - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_remove_time_spent - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_remove_zoom - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_reopen - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_severity - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_shrug - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_spend_subtract - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_spend_add - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_submit_review - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_subscribe - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_tableflip - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_tag - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_target_branch - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_title - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_todo - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_unassign_specific - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_unassign_all - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_unassign_reviewer - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_unlabel_specific - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_unlabel_all - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_unlock - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_unsubscribe - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_wip - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_zoom - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_link - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_invite_email_single - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_invite_email_multiple - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_add_contacts - category: quickactions redis_slot: quickactions aggregation: weekly - name: i_quickactions_remove_contacts - category: quickactions redis_slot: quickactions aggregation: weekly diff --git a/lib/gitlab/usage_data_counters/known_events/work_items.yml b/lib/gitlab/usage_data_counters/known_events/work_items.yml index 6c90e4b2533..1f0cc0c8a2e 100644 --- a/lib/gitlab/usage_data_counters/known_events/work_items.yml +++ b/lib/gitlab/usage_data_counters/known_events/work_items.yml @@ -1,35 +1,28 @@ --- - name: users_updating_work_item_title - category: work_items redis_slot: users aggregation: weekly - name: users_creating_work_items - category: work_items redis_slot: users aggregation: weekly - name: users_updating_work_item_dates - category: work_items redis_slot: users aggregation: weekly - name: users_updating_work_item_labels - category: work_items redis_slot: users aggregation: weekly - name: users_updating_work_item_milestone - category: work_items redis_slot: users aggregation: weekly - name: users_updating_work_item_iteration # The event tracks an EE feature. # It's added here so it can be aggregated into the CE/EE 'OR' aggregate metrics. # It will report 0 for CE instances and should not be used with 'AND' aggregators. - category: work_items redis_slot: users aggregation: weekly - name: users_updating_weight_estimate # The event tracks an EE feature. # It's added here so it can be aggregated into the CE/EE 'OR' aggregate metrics. # It will report 0 for CE instances and should not be used with 'AND' aggregators. - category: work_items redis_slot: users aggregation: weekly diff --git a/lib/tasks/gitlab/packages/events.rake b/lib/tasks/gitlab/packages/events.rake index a5b801ff62d..0f0f7616ba5 100644 --- a/lib/tasks/gitlab/packages/events.rake +++ b/lib/tasks/gitlab/packages/events.rake @@ -49,7 +49,6 @@ namespace :gitlab do events_definition = Packages::Event.unique_counters_for(event_scope, event_type, originator_type).map do |event_name| { "name" => event_name, - "category" => "#{originator_type}_packages", "aggregation" => "weekly", "redis_slot" => "package" } diff --git a/locale/gitlab.pot b/locale/gitlab.pot index d6122ef21d9..24c338fc109 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -48218,6 +48218,9 @@ msgstr "" msgid "Webhooks|A subgroup is created or removed." msgstr "" +msgid "Webhooks|A webhook in this group was automatically disabled after being retried multiple times." +msgstr "" + msgid "Webhooks|A webhook in this project was automatically disabled after being retried multiple times." msgstr "" diff --git a/spec/frontend/saved_replies/components/list_spec.js b/spec/frontend/saved_replies/components/list_spec.js index 66e9ddfe148..19063767766 100644 --- a/spec/frontend/saved_replies/components/list_spec.js +++ b/spec/frontend/saved_replies/components/list_spec.js @@ -1,29 +1,20 @@ -import Vue from 'vue'; import { mount } from '@vue/test-utils'; -import VueApollo from 'vue-apollo'; import noSavedRepliesResponse from 'test_fixtures/graphql/saved_replies/saved_replies_empty.query.graphql.json'; import savedRepliesResponse from 'test_fixtures/graphql/saved_replies/saved_replies.query.graphql.json'; -import createMockApollo from 'helpers/mock_apollo_helper'; -import waitForPromises from 'helpers/wait_for_promises'; import List from '~/saved_replies/components/list.vue'; import ListItem from '~/saved_replies/components/list_item.vue'; -import savedRepliesQuery from '~/saved_replies/queries/saved_replies.query.graphql'; let wrapper; -function createMockApolloProvider(response) { - Vue.use(VueApollo); - - const requestHandlers = [[savedRepliesQuery, jest.fn().mockResolvedValue(response)]]; - - return createMockApollo(requestHandlers); -} - -function createComponent(options = {}) { - const { mockApollo } = options; +function createComponent(res = {}) { + const { savedReplies } = res.data.currentUser; return mount(List, { - apolloProvider: mockApollo, + propsData: { + savedReplies: savedReplies.nodes, + pageInfo: savedReplies.pageInfo, + count: savedReplies.count, + }, }); } @@ -32,30 +23,21 @@ describe('Saved replies list component', () => { wrapper.destroy(); }); - it('does not render any list items when response is empty', async () => { - const mockApollo = createMockApolloProvider(noSavedRepliesResponse); - wrapper = createComponent({ mockApollo }); - - await waitForPromises(); + it('does not render any list items when response is empty', () => { + wrapper = createComponent(noSavedRepliesResponse); expect(wrapper.findAllComponents(ListItem).length).toBe(0); }); - it('render saved replies count', async () => { - const mockApollo = createMockApolloProvider(savedRepliesResponse); - wrapper = createComponent({ mockApollo }); - - await waitForPromises(); + it('render saved replies count', () => { + wrapper = createComponent(savedRepliesResponse); expect(wrapper.find('[data-testid="title"]').text()).toEqual('My saved replies (2)'); }); - it('renders list of saved replies', async () => { - const mockApollo = createMockApolloProvider(savedRepliesResponse); + it('renders list of saved replies', () => { const savedReplies = savedRepliesResponse.data.currentUser.savedReplies.nodes; - wrapper = createComponent({ mockApollo }); - - await waitForPromises(); + wrapper = createComponent(savedRepliesResponse); expect(wrapper.findAllComponents(ListItem).length).toBe(2); expect(wrapper.findAllComponents(ListItem).at(0).props('reply')).toEqual( diff --git a/spec/frontend/saved_replies/pages/index_spec.js b/spec/frontend/saved_replies/pages/index_spec.js new file mode 100644 index 00000000000..fe47e778d44 --- /dev/null +++ b/spec/frontend/saved_replies/pages/index_spec.js @@ -0,0 +1,49 @@ +import Vue from 'vue'; +import { mount } from '@vue/test-utils'; +import VueApollo from 'vue-apollo'; +import savedRepliesResponse from 'test_fixtures/graphql/saved_replies/saved_replies.query.graphql.json'; +import createMockApollo from 'helpers/mock_apollo_helper'; +import waitForPromises from 'helpers/wait_for_promises'; +import IndexPage from '~/saved_replies/pages/index.vue'; +import ListItem from '~/saved_replies/components/list_item.vue'; +import savedRepliesQuery from '~/saved_replies/queries/saved_replies.query.graphql'; + +let wrapper; + +function createMockApolloProvider(response) { + Vue.use(VueApollo); + + const requestHandlers = [[savedRepliesQuery, jest.fn().mockResolvedValue(response)]]; + + return createMockApollo(requestHandlers); +} + +function createComponent(options = {}) { + const { mockApollo } = options; + + return mount(IndexPage, { + apolloProvider: mockApollo, + }); +} + +describe('Saved replies index page component', () => { + afterEach(() => { + wrapper.destroy(); + }); + + it('renders list of saved replies', async () => { + const mockApollo = createMockApolloProvider(savedRepliesResponse); + const savedReplies = savedRepliesResponse.data.currentUser.savedReplies.nodes; + wrapper = createComponent({ mockApollo }); + + await waitForPromises(); + + expect(wrapper.findAllComponents(ListItem).length).toBe(2); + expect(wrapper.findAllComponents(ListItem).at(0).props('reply')).toEqual( + expect.objectContaining(savedReplies[0]), + ); + expect(wrapper.findAllComponents(ListItem).at(1).props('reply')).toEqual( + expect.objectContaining(savedReplies[1]), + ); + }); +}); diff --git a/spec/lib/gitlab/usage_data_counters/code_review_events_spec.rb b/spec/lib/gitlab/usage_data_counters/code_review_events_spec.rb index 63a1da490ed..7d180ed13a0 100644 --- a/spec/lib/gitlab/usage_data_counters/code_review_events_spec.rb +++ b/spec/lib/gitlab/usage_data_counters/code_review_events_spec.rb @@ -6,17 +6,23 @@ require 'spec_helper' # NOTE: ONLY user related metrics to be added to the aggregates - otherwise add it to the exception list RSpec.describe 'Code review events' do it 'the aggregated metrics contain all the code review metrics' do - code_review_events = Gitlab::UsageDataCounters::HLLRedisCounter.events_for_category("code_review") + user_related_events = %w[i_code_review_create_mr i_code_review_mr_diffs i_code_review_mr_with_invalid_approvers i_code_review_mr_single_file_diffs i_code_review_total_suggestions_applied i_code_review_total_suggestions_added i_code_review_create_note_in_ipynb_diff i_code_review_create_note_in_ipynb_diff_mr i_code_review_create_note_in_ipynb_diff_commit] + + all_code_review_events = Gitlab::Usage::MetricDefinition.all.flat_map do |definition| + next [] unless definition.attributes[:key_path].include?('.code_review.') && + definition.attributes[:status] == 'active' && + definition.attributes[:instrumentation_class] != 'AggregatedMetric' + + definition.attributes.dig(:options, :events) + end.uniq.compact + code_review_aggregated_events = Gitlab::Usage::MetricDefinition.all.flat_map do |definition| next [] unless code_review_aggregated_metric?(definition.attributes) definition.attributes.dig(:options, :events) end.uniq - exceptions = %w[i_code_review_create_mr i_code_review_mr_diffs i_code_review_mr_with_invalid_approvers i_code_review_mr_single_file_diffs i_code_review_total_suggestions_applied i_code_review_total_suggestions_added i_code_review_create_note_in_ipynb_diff i_code_review_create_note_in_ipynb_diff_mr i_code_review_create_note_in_ipynb_diff_commit] - code_review_aggregated_events += exceptions - - expect(code_review_events - code_review_aggregated_events).to be_empty + expect(all_code_review_events - (code_review_aggregated_events + user_related_events)).to be_empty end def code_review_aggregated_metric?(attributes) diff --git a/spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb index f955fd265e5..3322075cd5c 100644 --- a/spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb +++ b/spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb @@ -23,39 +23,6 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s described_class.clear_memoization(:known_events) end - describe '.categories' do - it 'gets CE unique category names' do - expect(described_class.categories).to include( - 'analytics', - 'ci_templates', - 'ci_users', - 'code_review', - 'deploy_token_packages', - 'ecosystem', - 'environments', - 'error_tracking', - 'geo', - 'ide_edit', - 'importer', - 'incident_management_alerts', - 'incident_management', - 'issues_edit', - 'kubernetes_agent', - 'manage', - 'pipeline_authoring', - 'quickactions', - 'search', - 'secure', - 'snippets', - 'source_code', - 'terraform', - 'testing', - 'user_packages', - 'work_items' - ) - end - end - describe '.known_events' do let(:ce_temp_dir) { Dir.mktmpdir } let(:ce_temp_file) { Tempfile.new(%w[common .yml], ce_temp_dir) } @@ -63,7 +30,6 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s { "name" => "ce_event", "redis_slot" => "analytics", - "category" => "analytics", "aggregation" => "weekly" } end @@ -105,13 +71,13 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s let(:known_events) do [ - { name: weekly_event, redis_slot: "analytics", category: analytics_category, aggregation: "weekly", feature_flag: feature }, - { name: daily_event, redis_slot: "analytics", category: analytics_category, aggregation: "daily" }, - { name: category_productivity_event, redis_slot: "analytics", category: productivity_category, aggregation: "weekly" }, - { name: compliance_slot_event, redis_slot: "compliance", category: compliance_category, aggregation: "weekly" }, - { name: no_slot, category: global_category, aggregation: "daily" }, - { name: different_aggregation, category: global_category, aggregation: "monthly" }, - { name: context_event, category: other_category, aggregation: 'weekly' } + { name: weekly_event, redis_slot: "analytics", aggregation: "weekly", feature_flag: feature }, + { name: daily_event, redis_slot: "analytics", aggregation: "daily" }, + { name: category_productivity_event, redis_slot: "analytics", aggregation: "weekly" }, + { name: compliance_slot_event, redis_slot: "compliance", aggregation: "weekly" }, + { name: no_slot, aggregation: "daily" }, + { name: different_aggregation, aggregation: "monthly" }, + { name: context_event, aggregation: 'weekly' } ].map(&:with_indifferent_access) end @@ -121,12 +87,6 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s allow(described_class).to receive(:known_events).and_return(known_events) end - describe '.events_for_category' do - it 'gets the event names for given category' do - expect(described_class.events_for_category(:analytics)).to contain_exactly(weekly_event, daily_event) - end - end - describe '.track_event' do context 'with redis_hll_tracking' do it 'tracks the event when feature enabled' do @@ -346,12 +306,6 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s end.to raise_error(Gitlab::UsageDataCounters::HLLRedisCounter::SlotMismatch) end - it 'raise error if metrics are not in the same category' do - expect do - described_class.unique_events(event_names: [category_analytics_event, category_productivity_event], start_date: 4.weeks.ago, end_date: Date.current) - end.to raise_error(Gitlab::UsageDataCounters::HLLRedisCounter::CategoryMismatch) - end - it "raise error if metrics don't have same aggregation" do expect do described_class.unique_events(event_names: [daily_event, weekly_event], start_date: 4.weeks.ago, end_date: Date.current) diff --git a/spec/lib/gitlab/usage_data_counters/issue_activity_unique_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/issue_activity_unique_counter_spec.rb index 33e0d446fca..383938b0324 100644 --- a/spec/lib/gitlab/usage_data_counters/issue_activity_unique_counter_spec.rb +++ b/spec/lib/gitlab/usage_data_counters/issue_activity_unique_counter_spec.rb @@ -306,7 +306,7 @@ RSpec.describe Gitlab::UsageDataCounters::IssueActivityUniqueCounter, :clean_git described_class.track_issue_assignee_changed_action(author: user3, project: project) end - events = Gitlab::UsageDataCounters::HLLRedisCounter.events_for_category(described_class::ISSUE_CATEGORY) + events = [described_class::ISSUE_TITLE_CHANGED, described_class::ISSUE_DESCRIPTION_CHANGED, described_class::ISSUE_ASSIGNEE_CHANGED] today_count = Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: events, start_date: time, end_date: time) week_count = Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: events, start_date: time - 5.days, end_date: 1.day.since(time)) diff --git a/spec/lib/gitlab/utils/usage_data_spec.rb b/spec/lib/gitlab/utils/usage_data_spec.rb index 2925ceef256..586ee04a835 100644 --- a/spec/lib/gitlab/utils/usage_data_spec.rb +++ b/spec/lib/gitlab/utils/usage_data_spec.rb @@ -487,12 +487,12 @@ RSpec.describe Gitlab::Utils::UsageData do end context 'when Redis HLL raises any error' do - subject { described_class.redis_usage_data { raise Gitlab::UsageDataCounters::HLLRedisCounter::CategoryMismatch } } + subject { described_class.redis_usage_data { raise Gitlab::UsageDataCounters::HLLRedisCounter::EventError } } let(:fallback) { 15 } let(:failing_class) { nil } - it_behaves_like 'failing hardening method', Gitlab::UsageDataCounters::HLLRedisCounter::CategoryMismatch + it_behaves_like 'failing hardening method', Gitlab::UsageDataCounters::HLLRedisCounter::EventError end it 'returns the evaluated block when given' do diff --git a/spec/migrations/20221102231130_finalize_backfill_user_details_fields_spec.rb b/spec/migrations/20221102231130_finalize_backfill_user_details_fields_spec.rb new file mode 100644 index 00000000000..7ad9f4ed156 --- /dev/null +++ b/spec/migrations/20221102231130_finalize_backfill_user_details_fields_spec.rb @@ -0,0 +1,93 @@ +# frozen_string_literal: true + +require 'spec_helper' + +require_migration! + +RSpec.describe FinalizeBackfillUserDetailsFields, :migration, feature_category: :user_management do + let(:batched_migrations) { table(:batched_background_migrations) } + let(:batch_failed_status) { 2 } + let(:batch_finalized_status) { 3 } + + let!(:migration) { described_class::BACKFILL_MIGRATION } + + describe '#up' do + shared_examples 'finalizes the migration' do + it 'finalizes the migration' do + expect do + migrate! + + migration_record.reload + failed_job.reload + end.to change { migration_record.status }.from(migration_record.status).to(3).and( + change { failed_job.status }.from(batch_failed_status).to(batch_finalized_status) + ) + end + end + + context 'when migration is missing' do + it 'warns migration not found' do + expect(Gitlab::AppLogger) + .to receive(:warn).with(/Could not find batched background migration for the given configuration:/) + + migrate! + end + end + + context 'with migration present' do + let!(:migration_record) do + batched_migrations.create!( + job_class_name: migration, + table_name: :users, + column_name: :id, + job_arguments: [], + interval: 2.minutes, + min_value: 1, + max_value: 2, + batch_size: 1000, + sub_batch_size: 500, + max_batch_size: 5000, + gitlab_schema: :gitlab_main, + status: 3 # finished + ) + end + + context 'when migration finished successfully' do + it 'does not raise exception' do + expect { migrate! }.not_to raise_error + end + end + + context 'with different migration statuses', :redis do + using RSpec::Parameterized::TableSyntax + + where(:status, :description) do + 0 | 'paused' + 1 | 'active' + 4 | 'failed' + 5 | 'finalizing' + end + + with_them do + let!(:failed_job) do + table(:batched_background_migration_jobs).create!( + batched_background_migration_id: migration_record.id, + status: batch_failed_status, + min_value: 1, + max_value: 10, + attempts: 2, + batch_size: 100, + sub_batch_size: 10 + ) + end + + before do + migration_record.update!(status: status) + end + + it_behaves_like 'finalizes the migration' + end + end + end + end +end diff --git a/spec/models/concerns/web_hooks/has_web_hooks_spec.rb b/spec/models/concerns/web_hooks/has_web_hooks_spec.rb new file mode 100644 index 00000000000..afb2406a969 --- /dev/null +++ b/spec/models/concerns/web_hooks/has_web_hooks_spec.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe WebHooks::HasWebHooks, feature_category: :integrations do + let(:minimal_test_class) do + Class.new do + include WebHooks::HasWebHooks + + def id + 1 + end + end + end + + before do + stub_const('MinimalTestClass', minimal_test_class) + end + + describe '#last_failure_redis_key' do + subject { MinimalTestClass.new.last_failure_redis_key } + + it { is_expected.to eq('web_hooks:last_failure:minimal_test_class-1') } + end + + describe 'last_webhook_failure', :clean_gitlab_redis_shared_state do + subject { MinimalTestClass.new.last_webhook_failure } + + it { is_expected.to eq(nil) } + + context 'when there was an older failure', :clean_gitlab_redis_shared_state do + let(:last_failure_date) { 1.month.ago.iso8601 } + + before do + Gitlab::Redis::SharedState.with { |r| r.set('web_hooks:last_failure:minimal_test_class-1', last_failure_date) } + end + + it { is_expected.to eq(last_failure_date) } + end + end +end diff --git a/spec/support/shared_examples/models/concerns/web_hooks/has_web_hooks_shared_examples.rb b/spec/support/shared_examples/models/concerns/web_hooks/has_web_hooks_shared_examples.rb index cd6eb8c77fa..fa33db66c3b 100644 --- a/spec/support/shared_examples/models/concerns/web_hooks/has_web_hooks_shared_examples.rb +++ b/spec/support/shared_examples/models/concerns/web_hooks/has_web_hooks_shared_examples.rb @@ -83,7 +83,7 @@ RSpec.shared_examples 'something that has web-hooks' do describe '#fetch_web_hook_failure', :clean_gitlab_redis_shared_state do context 'when a value has not been stored' do - it 'does not call #any_hook_failed?' do + it 'calls #any_hook_failed?' do expect(object.get_web_hook_failure).to be_nil expect(object).to receive(:any_hook_failed?).and_return(true) diff --git a/workhorse/go.mod b/workhorse/go.mod index fc681795095..9347a0ca300 100644 --- a/workhorse/go.mod +++ b/workhorse/go.mod @@ -32,8 +32,8 @@ require ( gocloud.dev v0.28.0 golang.org/x/image v0.5.0 golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 - golang.org/x/net v0.5.0 - golang.org/x/oauth2 v0.4.0 + golang.org/x/net v0.6.0 + golang.org/x/oauth2 v0.5.0 golang.org/x/tools v0.2.0 google.golang.org/grpc v1.53.0 google.golang.org/protobuf v1.28.1 diff --git a/workhorse/go.sum b/workhorse/go.sum index 362ceff958b..1efb189a752 100644 --- a/workhorse/go.sum +++ b/workhorse/go.sum @@ -2127,8 +2127,8 @@ golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20170912212905-13449ad91cb2/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -2159,8 +2159,8 @@ golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= golang.org/x/oauth2 v0.2.0/go.mod h1:Cwn6afJ8jrQwYMxQDTpISoXmXW9I6qF6vDeuuoX3Ibs= -golang.org/x/oauth2 v0.4.0 h1:NF0gk8LVPg1Ml7SSbGyySuoxdsXitj7TvgvuRxIMc/M= -golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec= +golang.org/x/oauth2 v0.5.0 h1:HuArIo48skDwlrvM3sEdHXElYslAMsf3KwRkkW4MC4s= +golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= golang.org/x/sync v0.0.0-20170517211232-f52d1811a629/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -- cgit v1.2.3