Class: RailsPulse::Summary
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- RailsPulse::Summary
- Defined in:
- app/models/rails_pulse/summary.rb
Constant Summary collapse
- PERIOD_TYPES =
%w[hour day week month].freeze
Class Method Summary collapse
- .calculate_period_end(period_type, start_time) ⇒ Object
- .normalize_period_start(period_type, time) ⇒ Object
- .ransackable_associations(auth_object = nil) ⇒ Object
-
.ransackable_attributes(auth_object = nil) ⇒ Object
Ransack configuration.
Class Method Details
.calculate_period_end(period_type, start_time) ⇒ Object
168 169 170 171 172 173 174 175 |
# File 'app/models/rails_pulse/summary.rb', line 168 def calculate_period_end(period_type, start_time) case period_type when "hour" then start_time.end_of_hour when "day" then start_time.end_of_day when "week" then start_time.end_of_week when "month" then start_time.end_of_month end end |
.normalize_period_start(period_type, time) ⇒ Object
177 178 179 180 181 182 183 184 |
# File 'app/models/rails_pulse/summary.rb', line 177 def normalize_period_start(period_type, time) case period_type when "hour" then time.beginning_of_hour when "day" then time.beginning_of_day when "week" then time.beginning_of_week when "month" then time.beginning_of_month end end |
.ransackable_associations(auth_object = nil) ⇒ Object
82 83 84 |
# File 'app/models/rails_pulse/summary.rb', line 82 def self.ransackable_associations(auth_object = nil) %w[route query job] end |
.ransackable_attributes(auth_object = nil) ⇒ Object
Ransack configuration
73 74 75 76 77 78 79 80 |
# File 'app/models/rails_pulse/summary.rb', line 73 def self.ransackable_attributes(auth_object = nil) %w[ period_start period_end avg_duration min_duration max_duration p95_duration p99_duration count error_count requests_per_minute error_rate_percentage route_path_cont execution_count total_time_consumed normalized_sql summarizable_id summarizable_type ] end |