diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-25 21:09:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-25 21:09:02 +0300 |
commit | 951616a26a61e880860ad862c1d45a8e3762b4bc (patch) | |
tree | ed6fe722e955aff38e13ca02d2aa7fdd4239c863 /lib/gitlab/profiler.rb | |
parent | e06d0e779673d745972863302858105aad9032e5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/profiler.rb')
-rw-r--r-- | lib/gitlab/profiler.rb | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/gitlab/profiler.rb b/lib/gitlab/profiler.rb index f47ccb8fed9..e10cdf0d8fb 100644 --- a/lib/gitlab/profiler.rb +++ b/lib/gitlab/profiler.rb @@ -2,6 +2,8 @@ module Gitlab module Profiler + extend WithRequestStore + FILTERED_STRING = '[FILTERED]' IGNORE_BACKTRACES = %w[ @@ -58,28 +60,26 @@ module Gitlab logger = create_custom_logger(logger, private_token: private_token) - RequestStore.begin! - - # Make an initial call for an asset path in development mode to avoid - # sprockets dominating the profiler output. - ActionController::Base.helpers.asset_path('katex.css') if Rails.env.development? + result = with_request_store do + # Make an initial call for an asset path in development mode to avoid + # sprockets dominating the profiler output. + ActionController::Base.helpers.asset_path('katex.css') if Rails.env.development? - # Rails loads internationalization files lazily the first time a - # translation is needed. Running this prevents this overhead from showing - # up in profiles. - ::I18n.t('.')[:test_string] + # Rails loads internationalization files lazily the first time a + # translation is needed. Running this prevents this overhead from showing + # up in profiles. + ::I18n.t('.')[:test_string] - # Remove API route mounting from the profile. - app.get('/api/v4/users') + # Remove API route mounting from the profile. + app.get('/api/v4/users') - result = with_custom_logger(logger) do - with_user(user) do - RubyProf.profile { app.public_send(verb, url, params: post_data, headers: headers) } # rubocop:disable GitlabSecurity/PublicSend + with_custom_logger(logger) do + with_user(user) do + RubyProf.profile { app.public_send(verb, url, params: post_data, headers: headers) } # rubocop:disable GitlabSecurity/PublicSend + end end end - RequestStore.end! - log_load_times_by_model(logger) result |