2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
class Admin::RequestsProfilesController < Admin::ApplicationController
|
2022-06-21 17:19:12 +05:30
|
|
|
feature_category :not_owned # rubocop:todo Gitlab/AvoidFeatureCategoryNotOwned
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
def index
|
|
|
|
@profile_token = Gitlab::RequestProfiler.profile_token
|
2019-10-12 21:52:04 +05:30
|
|
|
@profiles = Gitlab::RequestProfiler.all.group_by(&:request_path)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
clean_name = Rack::Utils.clean_path_info(params[:name])
|
2019-10-12 21:52:04 +05:30
|
|
|
profile = Gitlab::RequestProfiler.find(clean_name)
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2019-10-12 21:52:04 +05:30
|
|
|
unless profile && profile.content_type
|
|
|
|
return redirect_to admin_requests_profiles_path, alert: 'Profile not found'
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
2019-10-12 21:52:04 +05:30
|
|
|
|
|
|
|
send_file profile.file_path, type: "#{profile.content_type}; charset=utf-8", disposition: 'inline'
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
end
|