diff options
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 |