Class: RailsHealthChecks::Checks::MemoryCheck
- Inherits:
-
RailsHealthChecks::Check
- Object
- RailsHealthChecks::Check
- RailsHealthChecks::Checks::MemoryCheck
- Defined in:
- lib/rails_health_checks/checks/memory_check.rb
Instance Attribute Summary
Attributes inherited from RailsHealthChecks::Check
#latency_ms, #message, #status
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(threshold: nil) ⇒ MemoryCheck
constructor
A new instance of MemoryCheck.
Constructor Details
#initialize(threshold: nil) ⇒ MemoryCheck
Returns a new instance of MemoryCheck.
8 9 10 |
# File 'lib/rails_health_checks/checks/memory_check.rb', line 8 def initialize(threshold: nil) @threshold = threshold end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rails_health_checks/checks/memory_check.rb', line 12 def call rss = nil measure { rss = rss_bytes } if @threshold && rss > @threshold return warn_with("process RSS #{rss} bytes exceeds threshold #{@threshold} bytes") end pass rescue StandardError => e fail_with(e.) end |