Class: Railswatch::Reports::PercentileReport

Inherits:
BaseReport
  • Object
show all
Defined in:
lib/railswatch/reports/percentile_report.rb

Instance Attribute Summary

Attributes inherited from BaseReport

#db, #group, #sort, #title

Instance Method Summary collapse

Methods inherited from BaseReport

#initialize, #nil_data, #nullify_data, #set_defaults, time_in_app_time_zone

Constructor Details

This class inherits a constructor from Railswatch::Reports::BaseReport

Instance Method Details

#dataObject



6
7
8
9
10
11
12
13
# File 'lib/railswatch/reports/percentile_report.rb', line 6

def data
  durations = db.pluck(:duration_ms).compact
  {
    p50: Railswatch::Utils.percentile(durations, 50),
    p95: Railswatch::Utils.percentile(durations, 95),
    p99: Railswatch::Utils.percentile(durations, 99)
  }
end