2018-09-14 05:42:05 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-07-15 15:46:39 +00:00
|
|
|
class Admin::RequestsProfilesController < Admin::ApplicationController
|
|
|
|
def index
|
|
|
|
@profile_token = Gitlab::RequestProfiler.profile_token
|
|
|
|
@profiles = Gitlab::RequestProfiler::Profile.all.group_by(&:request_path)
|
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
clean_name = Rack::Utils.clean_path_info(params[:name])
|
|
|
|
profile = Gitlab::RequestProfiler::Profile.find(clean_name)
|
|
|
|
|
2019-06-27 13:42:14 +00:00
|
|
|
unless profile && profile.content_type
|
|
|
|
return redirect_to admin_requests_profiles_path, alert: 'Profile not found'
|
2016-07-15 15:46:39 +00:00
|
|
|
end
|
2019-06-27 13:42:14 +00:00
|
|
|
|
|
|
|
send_file profile.file_path, type: "#{profile.content_type}; charset=utf-8", disposition: 'inline'
|
2016-07-15 15:46:39 +00:00
|
|
|
end
|
|
|
|
end
|