Sha256: fd7b3b561975a75ac4065f03d52c4d25b5346af965857d36cd96d2b7d9489b0f

Contents?: true

Size: 638 Bytes

Versions: 12

Compression:

Stored size: 638 Bytes

Contents

module RailsPerformance
  module Reports
    class SlowRequestsReport < BaseReport
      def set_defaults
        @sort ||= :datetimei
      end

      def data
        db.data
          .collect { |e| e.record_hash }
          .select { |e| e if e[sort] > RailsPerformance.slow_requests_time_window.ago.to_i }
          .sort { |a, b| b[sort] <=> a[sort] }
          .filter { |e| e[:duration] > RailsPerformance.slow_requests_threshold.to_i }
          .first(limit)
      end

      private

      def limit
        RailsPerformance.slow_requests_limit ? RailsPerformance.slow_requests_limit.to_i : 100_000
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rails_performance-1.4.1 lib/rails_performance/reports/slow_requests_report.rb
rails_performance-1.4.1.alpha1 lib/rails_performance/reports/slow_requests_report.rb
rails_performance-1.4.0 lib/rails_performance/reports/slow_requests_report.rb
rails_performance-1.4.0.alpha5 lib/rails_performance/reports/slow_requests_report.rb
rails_performance-1.4.0.alpha4 lib/rails_performance/reports/slow_requests_report.rb
rails_performance-1.4.0.alpha3 lib/rails_performance/reports/slow_requests_report.rb
rails_performance-1.4.0.alpha2 lib/rails_performance/reports/slow_requests_report.rb
rails_performance-1.4.0.alpha1 lib/rails_performance/reports/slow_requests_report.rb
rails_performance-1.3.3 lib/rails_performance/reports/slow_requests_report.rb
rails_performance-1.3.2 lib/rails_performance/reports/slow_requests_report.rb
rails_performance-1.3.1 lib/rails_performance/reports/slow_requests_report.rb
rails_performance-1.3.0 lib/rails_performance/reports/slow_requests_report.rb