Class: Railswatch::Widgets::MemoryUsage
- Inherits:
-
ResourceChart
- Object
- Base
- Chart
- ResourceChart
- Railswatch::Widgets::MemoryUsage
- Defined in:
- lib/railswatch/widgets/resource_chart.rb
Instance Attribute Summary
Attributes inherited from ResourceChart
Attributes inherited from Chart
#description, #legend, #subtitle, #units
Attributes inherited from Base
Instance Method Summary collapse
- #format(measurement) ⇒ Object
-
#initialize(server) ⇒ MemoryUsage
constructor
A new instance of MemoryUsage.
- #measure ⇒ Object
Methods inherited from ResourceChart
Methods inherited from Chart
#data, #id, #to_partial_path, #type
Methods inherited from Base
Constructor Details
#initialize(server) ⇒ MemoryUsage
Returns a new instance of MemoryUsage.
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/railswatch/widgets/resource_chart.rb', line 63 def initialize(server) super( server, key: :memory, type: 'Usage', subtitle: 'Memory', description: 'App memory usage', legend: 'Usage', ) end |
Instance Method Details
#format(measurement) ⇒ Object
74 75 76 |
# File 'lib/railswatch/widgets/resource_chart.rb', line 74 def format(measurement) measurement.to_f.round(2) end |
#measure ⇒ Object
78 79 80 81 82 83 |
# File 'lib/railswatch/widgets/resource_chart.rb', line 78 def measure GetProcessMem.new.bytes rescue StandardError => e ::Rails.logger.error "Error fetching memory usage: #{e.}" 0 end |