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

Version Path
rails_performance-1.2.3 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-1.2.2 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-1.2.1 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-1.2.0 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-1.2.0.alpha5 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-1.2.0.alpha4 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-1.2.0.alpha3 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-1.2.0.alpha2 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-1.2.0.alpha1 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-1.1.0 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-1.0.5.3 lib/rails_performance/reports/recent_requests_report.rb