Sha256: 46e6499e20f35f04fdebfa96a72bd14c53f767423048eff9722604b6f9f5ff0d

Contents?: true

Size: 894 Bytes

Versions: 6

Compression:

Stored size: 894 Bytes

Contents

module RailsPerformance
  module Reports
    class RecentRequestsReport < BaseReport
      TIME_WINDOW = 60.minutes

      def set_defaults
        @sort ||= :datetime
      end

      def data
        db.data.collect do |record|
          {
            controller: record.controller,
            action: record.action,
            format: record.format,
            status: record.status,
            method: record.method,
            path: record.path,
            request_id: record.request_id,
            datetime: Time.at(record.datetimei.to_i),
            duration: record.value['duration'],
            db_runtime: record.value['db_runtime'],
            view_runtime: record.value['view_runtime'],
          }
        end
        .select{|e| e if e[:datetime] >= TIME_WINDOW.ago}
        .sort{|a, b| b[sort] <=> a[sort]}
      end
    end


  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_performance-0.9.0.1 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-0.9.0 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-0.0.1.19 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-0.0.1.18 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-0.0.1.17 lib/rails_performance/reports/recent_requests_report.rb
rails_performance-0.0.1.16 lib/rails_performance/reports/recent_requests_report.rb