summaryrefslogtreecommitdiff
path: root/app/controllers/admin/requests_profiles_controller.rb
blob: 89d4c4f18d967dbd1ad5491879a99f04a5c3d14e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

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)

    if profile
      render html: profile.content.html_safe
    else
      redirect_to admin_requests_profiles_path, alert: 'Profile not found'
    end
  end
end