Sha256: b21788b9d347d2cbbd6090fd04eb701d42b9718e41629d729eb168d0103b3487
Contents?: true
Size: 662 Bytes
Versions: 11
Compression:
Stored size: 662 Bytes
Contents
module RailsPerformance module Reports class RecentRequestsReport < BaseReport def set_defaults @sort ||= :datetimei end 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 private def limit RailsPerformance.recent_requests_limit ? RailsPerformance.recent_requests_limit.to_i : 100_000 end end end end
Version data entries
11 entries across 11 versions & 1 rubygems