Class: MemoryUsage
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- MemoryUsage
- Defined in:
- app/models/memory_usage.rb
Class Method Summary collapse
Class Method Details
.average_usage(start_time, group_by) ⇒ Object
4 5 6 7 8 9 |
# File 'app/models/memory_usage.rb', line 4 def self.average_usage(start_time, group_by) where(created_at: start_time..) .group_by_period(group_by, :created_at) .average(:used_percent) .transform_values { |value| value&.round(2) } end |