Class: ActiveInsights::RequestSeeder
- Inherits:
-
Object
- Object
- ActiveInsights::RequestSeeder
- Defined in:
- lib/active_insights/seeders/requests.rb
Instance Method Summary collapse
- #find_percentile(sorted_data, percentile) ⇒ Object
-
#initialize(date, rpm, p50, p95, p99) ⇒ RequestSeeder
constructor
A new instance of RequestSeeder.
- #seed ⇒ Object
Constructor Details
#initialize(date, rpm, p50, p95, p99) ⇒ RequestSeeder
Returns a new instance of RequestSeeder.
8 9 10 11 12 13 14 |
# File 'lib/active_insights/seeders/requests.rb', line 8 def initialize(date, rpm, p50, p95, p99) @date = date @rpm = rpm @p50 = p50 @p95 = p95 @p99 = p99 end |
Instance Method Details
#find_percentile(sorted_data, percentile) ⇒ Object
20 21 22 |
# File 'lib/active_insights/seeders/requests.rb', line 20 def find_percentile(sorted_data, percentile) sorted_data[(percentile * sorted_data.length).ceil - 1] end |
#seed ⇒ Object
16 17 18 |
# File 'lib/active_insights/seeders/requests.rb', line 16 def seed ActiveInsights::Request.insert_all(seed_attributes) end |