Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2016-07-15 18:46:39 +0300
committerAhmad Sherif <me@ahmadsherif.com>2016-07-26 21:06:09 +0300
commit345cd22f21e4e5a6e340c35e50b43105ee107570 (patch)
treed1f3916535c9bca94cb9c8fe16559332dcbf762e /lib/gitlab/request_profiler.rb
parent0c799be6b6fc0166473c82039ebf662a0558ed8f (diff)
Profile requests when a header is passed
Diffstat (limited to 'lib/gitlab/request_profiler.rb')
-rw-r--r--lib/gitlab/request_profiler.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/gitlab/request_profiler.rb b/lib/gitlab/request_profiler.rb
new file mode 100644
index 00000000000..8130e55351e
--- /dev/null
+++ b/lib/gitlab/request_profiler.rb
@@ -0,0 +1,19 @@
+require 'fileutils'
+
+module Gitlab
+ module RequestProfiler
+ PROFILES_DIR = "#{Gitlab.config.shared.path}/tmp/requests_profiles"
+
+ def profile_token
+ Rails.cache.fetch('profile-token') do
+ Devise.friendly_token
+ end
+ end
+ module_function :profile_token
+
+ def remove_all_profiles
+ FileUtils.rm_rf(PROFILES_DIR)
+ end
+ module_function :remove_all_profiles
+ end
+end