summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-25 03:08:49 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-25 03:08:49 +0000
commita8c82a6395ed62380b9061a26d92e41d46c2877e (patch)
treebd8ab49ac11104ad9ae953afd4c5e0036fdddaa2 /lib
parent0b881f91159cc97ccb7328a2e52977a60ea83fbe (diff)
downloadgitlab-ce-a8c82a6395ed62380b9061a26d92e41d46c2877e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/banzai/filter/inline_embeds_filter.rb11
-rw-r--r--lib/banzai/filter/inline_metrics_filter.rb8
-rw-r--r--lib/gitlab/config_checker/puma_rugged_checker.rb50
-rw-r--r--lib/gitlab/git/rugged_impl/use_rugged.rb22
4 files changed, 77 insertions, 14 deletions
diff --git a/lib/banzai/filter/inline_embeds_filter.rb b/lib/banzai/filter/inline_embeds_filter.rb
index 9f1ef0796f0..5b579aeae6b 100644
--- a/lib/banzai/filter/inline_embeds_filter.rb
+++ b/lib/banzai/filter/inline_embeds_filter.rb
@@ -6,6 +6,7 @@ module Banzai
# a given link format. To transform references to DB
# resources in place, prefer to inherit from AbstractReferenceFilter.
class InlineEmbedsFilter < HTML::Pipeline::Filter
+ include Gitlab::Utils::StrongMemoize
# Find every relevant link, create a new node based on
# the link, and insert this node after any html content
# surrounding the link.
@@ -60,6 +61,16 @@ module Banzai
link_pattern.match(url) { |m| m.named_captures }
end
+
+ # Parses query params out from full url string into hash.
+ #
+ # Ex) 'https://<root>/<project>/<environment>/metrics?title=Title&group=Group'
+ # --> { title: 'Title', group: 'Group' }
+ def query_params(url)
+ strong_memoize(:query_params) do
+ Gitlab::Metrics::Dashboard::Url.parse_query(url)
+ end
+ end
end
end
end
diff --git a/lib/banzai/filter/inline_metrics_filter.rb b/lib/banzai/filter/inline_metrics_filter.rb
index e8145e93851..21371e52680 100644
--- a/lib/banzai/filter/inline_metrics_filter.rb
+++ b/lib/banzai/filter/inline_metrics_filter.rb
@@ -42,14 +42,6 @@ module Banzai
**query_params(params['url'])
)
end
-
- # Parses query params out from full url string into hash.
- #
- # Ex) 'https://<root>/<project>/<environment>/metrics?title=Title&group=Group'
- # --> { title: 'Title', group: 'Group' }
- def query_params(url)
- Gitlab::Metrics::Dashboard::Url.parse_query(url)
- end
end
end
end
diff --git a/lib/gitlab/config_checker/puma_rugged_checker.rb b/lib/gitlab/config_checker/puma_rugged_checker.rb
new file mode 100644
index 00000000000..a9bbaebaf0b
--- /dev/null
+++ b/lib/gitlab/config_checker/puma_rugged_checker.rb
@@ -0,0 +1,50 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module ConfigChecker
+ module PumaRuggedChecker
+ extend self
+ extend Gitlab::Git::RuggedImpl::UseRugged
+
+ def check
+ return [] unless Gitlab::Runtime.puma?
+
+ notices = []
+
+ link_start = '<a href="https://docs.gitlab.com/ee/administration/operations/puma.html">'
+ link_end = '</a>'
+ notices << {
+ type: 'info',
+ message: _('You are running Puma, which is currently experimental. '\
+ 'More information is available in our '\
+ '%{link_start}documentation%{link_end}.') % { link_start: link_start, link_end: link_end }
+ }
+
+ if running_puma_with_multiple_threads?
+ link_start = '<a href="https://docs.gitlab.com/ee/administration/operations/puma.html">'
+ link_end = '</a>'
+ notices << {
+ type: 'info',
+ message: _('Puma is running with a thread count above 1. '\
+ 'Information on deprecated GitLab features in this configuration is available in the '\
+ '%{link_start}documentation%{link_end}.') % { link_start: link_start, link_end: link_end }
+ }
+ end
+
+ if running_puma_with_multiple_threads? && rugged_enabled_through_feature_flag?
+ link_start = '<a href="https://docs.gitlab.com/ee/administration/operations/puma.html#performance-caveat-when-using-puma-with-rugged">'
+ link_end = '</a>'
+ notices << {
+ type: 'warning',
+ message: _('Puma is running with a thread count above 1 and the rugged '\
+ 'service is enabled. This may decrease performance in some environments. '\
+ 'See our %{link_start}documentation%{link_end} '\
+ 'for details of this issue.') % { link_start: link_start, link_end: link_end }
+ }
+ end
+
+ notices
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/git/rugged_impl/use_rugged.rb b/lib/gitlab/git/rugged_impl/use_rugged.rb
index f63e35030c1..f9573bedba7 100644
--- a/lib/gitlab/git/rugged_impl/use_rugged.rb
+++ b/lib/gitlab/git/rugged_impl/use_rugged.rb
@@ -15,12 +15,6 @@ module Gitlab
Gitlab::GitalyClient.can_use_disk?(repo.storage)
end
- def running_puma_with_multiple_threads?
- return false unless Gitlab::Runtime.puma?
-
- ::Puma.respond_to?(:cli_config) && ::Puma.cli_config.options[:max_threads] > 1
- end
-
def execute_rugged_call(method_name, *args)
Gitlab::GitalyClient::StorageSettings.allow_disk_access do
start = Gitlab::Metrics::System.monotonic_time
@@ -43,6 +37,22 @@ module Gitlab
result
end
end
+
+ def running_puma_with_multiple_threads?
+ return false unless Gitlab::Runtime.puma?
+
+ ::Puma.respond_to?(:cli_config) && ::Puma.cli_config.options[:max_threads] > 1
+ end
+
+ def rugged_feature_keys
+ Gitlab::Git::RuggedImpl::Repository::FEATURE_FLAGS
+ end
+
+ def rugged_enabled_through_feature_flag?
+ rugged_feature_keys.any? do |feature_key|
+ Feature.enabled?(feature_key)
+ end
+ end
end
end
end