Class: RailsPerformance::Reports::RecentRequestsReport
- Inherits:
-
BaseReport
- Object
- BaseReport
- RailsPerformance::Reports::RecentRequestsReport
- Defined in:
- lib/rails_performance/reports/recent_requests_report.rb
Instance Attribute Summary
Attributes inherited from BaseReport
Instance Method Summary collapse
Methods inherited from BaseReport
#calculate_data, #collect, #initialize, time_in_app_time_zone
Constructor Details
This class inherits a constructor from RailsPerformance::Reports::BaseReport
Instance Method Details
#data(from_timei = nil) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/rails_performance/reports/recent_requests_report.rb', line 8 def data(from_timei = nil) time_agoi = [RailsPerformance.recent_requests_time_window.ago.to_i, from_timei.to_i].reject(&:blank?).max db.data .collect{|e| e.record_hash} .select{|e| e if e[sort] > time_agoi} .sort{|a, b| b[sort] <=> a[sort]} .first(limit) end |
#set_defaults ⇒ Object
4 5 6 |
# File 'lib/rails_performance/reports/recent_requests_report.rb', line 4 def set_defaults @sort ||= :datetimei end |