Class: Profiler::ProfilesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Profiler::ProfilesController
- Defined in:
- app/controllers/profiler/profiles_controller.rb
Instance Method Summary collapse
- #cache ⇒ Object
- #database ⇒ Object
- #flamegraph ⇒ Object
- #index ⇒ Object
- #performance ⇒ Object
- #show ⇒ Object
- #timeline ⇒ Object
- #views ⇒ Object
Instance Method Details
#cache ⇒ Object
57 58 59 60 61 62 |
# File 'app/controllers/profiler/profiles_controller.rb', line 57 def cache @profile = resolve_profile(params[:id]) return render plain: "Profile not found", status: :not_found unless @profile render json: @profile.collector_data("cache") end |
#database ⇒ Object
43 44 45 46 47 48 |
# File 'app/controllers/profiler/profiles_controller.rb', line 43 def database @profile = resolve_profile(params[:id]) return render plain: "Profile not found", status: :not_found unless @profile render json: @profile.collector_data("database") end |
#flamegraph ⇒ Object
71 72 73 74 75 76 |
# File 'app/controllers/profiler/profiles_controller.rb', line 71 def flamegraph @profile = resolve_profile(params[:id]) return render plain: "Profile not found", status: :not_found unless @profile render json: @profile.collector_data("flamegraph") end |
#index ⇒ Object
7 8 9 10 11 12 13 |
# File 'app/controllers/profiler/profiles_controller.rb', line 7 def index limit = params[:limit]&.to_i || 50 offset = params[:offset]&.to_i || 0 @profiles = Profiler.storage.list(limit: limit, offset: offset) @profiles = filter_profiles(@profiles) if params[:filter].present? end |
#performance ⇒ Object
64 65 66 67 68 69 |
# File 'app/controllers/profiler/profiles_controller.rb', line 64 def performance @profile = resolve_profile(params[:id]) return render plain: "Profile not found", status: :not_found unless @profile render json: @profile.collector_data("performance") end |
#show ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/profiler/profiles_controller.rb', line 15 def show @profile = resolve_profile(params[:id]) unless @profile render plain: "Profile not found", status: :not_found return end # Recalculate AJAX collector data (since AJAX requests happen after page load) recalculate_ajax_data(@profile) @profile_data = @profile.to_h.merge( child_jobs: build_child_jobs(@profile), parent_profile: build_parent_summary(@profile) ) @embedded = params[:embed] == "true" render layout: @embedded ? "profiler/embedded" : "profiler/application" end |
#timeline ⇒ Object
36 37 38 39 40 41 |
# File 'app/controllers/profiler/profiles_controller.rb', line 36 def timeline @profile = resolve_profile(params[:id]) return render plain: "Profile not found", status: :not_found unless @profile render json: @profile.collector_data("performance") end |
#views ⇒ Object
50 51 52 53 54 55 |
# File 'app/controllers/profiler/profiles_controller.rb', line 50 def views @profile = resolve_profile(params[:id]) return render plain: "Profile not found", status: :not_found unless @profile render json: @profile.collector_data("view") end |