Class: RailsPerformance::RailsPerformanceController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- RailsPerformance::RailsPerformanceController
- Defined in:
- app/controllers/rails_performance/rails_performance_controller.rb
Instance Method Summary collapse
- #crashes ⇒ Object
- #custom ⇒ Object
- #delayed_job ⇒ Object
- #grape ⇒ Object
- #index ⇒ Object
- #rake ⇒ Object
- #recent ⇒ Object
- #requests ⇒ Object
- #sidekiq ⇒ Object
- #slow ⇒ Object
- #summary ⇒ Object
- #trace ⇒ Object
Methods included from Concerns::CsvExportable
Instance Method Details
#crashes ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 43 def crashes @datasource = RailsPerformance::DataSource.new(**prepare_query({status_eq: 500}), type: :requests) db = @datasource.db @data = RailsPerformance::Reports::CrashReport.new(db).data respond_to do |format| format.html format.csv do export_to_csv "error_report", @data end end end |
#custom ⇒ Object
130 131 132 133 134 135 136 |
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 130 def custom @datasource = RailsPerformance::DataSource.new(**prepare_query(params), type: :custom) db = @datasource.db @throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data @response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data @recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data end |
#delayed_job ⇒ Object
122 123 124 125 126 127 128 |
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 122 def delayed_job @datasource = RailsPerformance::DataSource.new(**prepare_query(params), type: :delayed_job) db = @datasource.db @throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data @response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data @recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data end |
#grape ⇒ Object
138 139 140 141 142 143 |
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 138 def grape @datasource = RailsPerformance::DataSource.new(**prepare_query(params), type: :grape) db = @datasource.db @throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data @recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data end |
#index ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 8 def index @datasource = RailsPerformance::DataSource.new(**prepare_query(params), type: :requests) db = @datasource.db @throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data @response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data @percentile_report_data = RailsPerformance::Reports::PercentileReport.new(db).data end |
#rake ⇒ Object
145 146 147 148 149 150 |
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 145 def rake @datasource = RailsPerformance::DataSource.new(**prepare_query(params), type: :rake) db = @datasource.db @throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data @recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data end |
#recent ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 68 def recent @datasource = RailsPerformance::DataSource.new(**prepare_query(params), type: :requests) db = @datasource.db @data = RailsPerformance::Reports::RecentRequestsReport.new(db).data(params[:from_timei]) # example # :controller=>"HomeController", # :action=>"index", # :format=>"html", # :status=>"200", # :method=>"GET", # :path=>"/", # :request_id=>"9c9bff5f792a5b3f77cb07fa325f8ddf", # :datetime=>2023-06-24 21:22:46 +0300, # :datetimei=>1687630966, # :duration=>207.225830078125, # :db_runtime=>2.055999994277954, # :view_runtime=>67.8370000096038, # :exception=>nil, # :backtrace=>nil, # :http_referer=>nil, # "email"=>nil, # "user_agent"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"}] respond_to do |format| format.html format.js format.csv do export_to_csv "recent_requests_report", @data end end end |
#requests ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 56 def requests @datasource = RailsPerformance::DataSource.new(**prepare_query(params), type: :requests) db = @datasource.db @data = RailsPerformance::Reports::RequestsReport.new(db, group: :controller_action_format, sort: :count).data respond_to do |format| format.html format.csv do export_to_csv "requests_report", @data end end end |
#sidekiq ⇒ Object
114 115 116 117 118 119 120 |
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 114 def sidekiq @datasource = RailsPerformance::DataSource.new(**prepare_query(params), type: :sidekiq) db = @datasource.db @throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data @response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data @recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data end |
#slow ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 101 def slow @datasource = RailsPerformance::DataSource.new(**prepare_query(params), type: :requests) db = @datasource.db @data = RailsPerformance::Reports::SlowRequestsReport.new(db).data respond_to do |format| format.html format.csv do export_to_csv "slow_requests_report", @data end end end |
#summary ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 17 def summary @datasource = RailsPerformance::DataSource.new(**prepare_query(params), type: :requests) db = @datasource.db @throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data @response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data @data = RailsPerformance::Reports::BreakdownReport.new(db, title: "Requests").data respond_to do |format| format.js {} format.any do render plain: "Doesn't open in new window. Wait until full page load." end end end |
#trace ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 32 def trace @record = RailsPerformance::Models::RequestRecord.find_by(request_id: params[:id]) @data = RailsPerformance::Reports::TraceReport.new(request_id: params[:id]).data respond_to do |format| format.js {} format.any do render plain: "Doesn't open in new window. Wait until full page load." end end end |