Sha256: fc444b777739d06d358d4a48bcf8988cc26b1655df49a03acbc17de3fab69492

Contents?: true

Size: 626 Bytes

Versions: 10

Compression:

Stored size: 626 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

10 entries across 10 versions & 1 rubygems

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