debian-mirror-gitlab/app/controllers/admin/requests_profiles_controller.rb

20 lines
631 B
Ruby
Raw Normal View History

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