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
path: root/app
diff options
context:
space:
mode:
authorQingyu Zhao <qzhao@gitlab.com>2019-06-27 16:42:14 +0300
committerQingyu Zhao <qzhao@gitlab.com>2019-07-18 16:11:08 +0300
commit10e51ac5f7087bb9cbc495fc15195994fb8763e4 (patch)
treedb910ca437f1187f726fd60f7567592d5042673b /app
parent0854f18352e72c2bcc0beca601d1ea48b490d1be (diff)
Add profile mode to extend request profiling
Extend the support for "X-Profile-Token: <token>" to have an additional header that defines type of profile we are looking for, like: X-Profile-Mode: execution X-Profile-Mode: memory
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/requests_profiles_controller.rb8
-rw-r--r--app/views/admin/requests_profiles/index.html.haml3
2 files changed, 6 insertions, 5 deletions
diff --git a/app/controllers/admin/requests_profiles_controller.rb b/app/controllers/admin/requests_profiles_controller.rb
index 89d4c4f18d9..1d14812186a 100644
--- a/app/controllers/admin/requests_profiles_controller.rb
+++ b/app/controllers/admin/requests_profiles_controller.rb
@@ -10,10 +10,10 @@ class Admin::RequestsProfilesController < Admin::ApplicationController
clean_name = Rack::Utils.clean_path_info(params[:name])
profile = Gitlab::RequestProfiler::Profile.find(clean_name)
- if profile
- render html: profile.content.html_safe
- else
- redirect_to admin_requests_profiles_path, alert: 'Profile not found'
+ unless profile && profile.content_type
+ return redirect_to admin_requests_profiles_path, alert: 'Profile not found'
end
+
+ send_file profile.file_path, type: "#{profile.content_type}; charset=utf-8", disposition: 'inline'
end
end
diff --git a/app/views/admin/requests_profiles/index.html.haml b/app/views/admin/requests_profiles/index.html.haml
index adfc67d66d0..86bfeef580c 100644
--- a/app/views/admin/requests_profiles/index.html.haml
+++ b/app/views/admin/requests_profiles/index.html.haml
@@ -19,7 +19,8 @@
%ul.content-list
- profiles.each do |profile|
%li
- = link_to profile.time.to_s(:long), admin_requests_profile_path(profile)
+ = link_to profile.time.to_s(:long) + ' ' + profile.profile_mode.capitalize,
+ admin_requests_profile_path(profile)
- else
%p
No profiles found