diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-22 21:07:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-22 21:07:57 +0300 |
commit | 277c0c75bf32b40d882c35feafaae90f69c40dd9 (patch) | |
tree | 35f3969f59c1886fcfa71812cb2b942c46d9dffe /lib | |
parent | 5e44c2ba46e780552317dec29e3b51282dfd5696 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/metrics/subscribers/rails_cache.rb | 11 | ||||
-rw-r--r-- | lib/gitlab/usage_data_counters/hll_redis_counter.rb | 1 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/hidden_menu.rb | 4 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/repository_menu.rb | 2 |
4 files changed, 15 insertions, 3 deletions
diff --git a/lib/gitlab/metrics/subscribers/rails_cache.rb b/lib/gitlab/metrics/subscribers/rails_cache.rb index b5e087d107b..b12db9df66d 100644 --- a/lib/gitlab/metrics/subscribers/rails_cache.rb +++ b/lib/gitlab/metrics/subscribers/rails_cache.rb @@ -8,6 +8,17 @@ module Gitlab class RailsCache < ActiveSupport::Subscriber attach_to :active_support + def cache_read_multi(event) + observe(:read_multi, event.duration) + + return unless current_transaction + + current_transaction.observe(:gitlab_cache_read_multikey_count, event.payload[:key].size) do + buckets [10, 50, 100, 1000] + docstring 'Number of keys for mget in read_multi/fetch_multi' + end + end + def cache_read(event) observe(:read, event.duration) diff --git a/lib/gitlab/usage_data_counters/hll_redis_counter.rb b/lib/gitlab/usage_data_counters/hll_redis_counter.rb index 24a87ae01f4..eb4244cd390 100644 --- a/lib/gitlab/usage_data_counters/hll_redis_counter.rb +++ b/lib/gitlab/usage_data_counters/hll_redis_counter.rb @@ -176,6 +176,7 @@ module Gitlab event = event_for(event_name) Gitlab::ErrorTracking.track_and_raise_for_dev_exception(UnknownEvent.new("Unknown event #{event_name}")) unless event.present? + return if event.blank? return unless feature_enabled?(event) Gitlab::Redis::HLL.add(key: redis_key(event, time, context), value: values, expiry: expiry(event)) diff --git a/lib/sidebars/projects/menus/hidden_menu.rb b/lib/sidebars/projects/menus/hidden_menu.rb index c273ee8b74f..b334e137679 100644 --- a/lib/sidebars/projects/menus/hidden_menu.rb +++ b/lib/sidebars/projects/menus/hidden_menu.rb @@ -29,7 +29,7 @@ module Sidebars end def graph_menu_item - if !can?(context.current_user, :download_code, context.project) || + if !can?(context.current_user, :read_code, context.project) || context.project.empty_repo? return ::Sidebars::NilMenuItem.new(item_id: :graph) end @@ -72,7 +72,7 @@ module Sidebars end def commits_menu_item - if !can?(context.current_user, :download_code, context.project) || + if !can?(context.current_user, :read_code, context.project) || context.project.empty_repo? return ::Sidebars::NilMenuItem.new(item_id: :commits) end diff --git a/lib/sidebars/projects/menus/repository_menu.rb b/lib/sidebars/projects/menus/repository_menu.rb index c5245cd944d..5006f293424 100644 --- a/lib/sidebars/projects/menus/repository_menu.rb +++ b/lib/sidebars/projects/menus/repository_menu.rb @@ -6,7 +6,7 @@ module Sidebars class RepositoryMenu < ::Sidebars::Menu override :configure_menu_items def configure_menu_items - return false unless can?(context.current_user, :download_code, context.project) + return false unless can?(context.current_user, :read_code, context.project) return false if context.project.empty_repo? add_item(files_menu_item) |