Class: Gitlab::Memory::Watchdog::Monitor::HeapFragmentation
- Inherits:
-
Object
- Object
- Gitlab::Memory::Watchdog::Monitor::HeapFragmentation
- Defined in:
- lib/gitlab/memory/watchdog/monitor/heap_fragmentation.rb
Overview
A monitor that observes Ruby heap fragmentation. See Gitlab::Metrics::Memory for how heap fragmentation is defined.
Instance Attribute Summary collapse
-
#max_heap_fragmentation ⇒ Object
readonly
Returns the value of attribute max_heap_fragmentation.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(max_heap_fragmentation:) ⇒ HeapFragmentation
constructor
max_heap_fragmentation: The degree to which the Ruby heap is allowed to be fragmented.
Constructor Details
#initialize(max_heap_fragmentation:) ⇒ HeapFragmentation
max_heap_fragmentation:
The degree to which the Ruby heap is allowed to be fragmented. Range [0,1].
14 15 16 17 |
# File 'lib/gitlab/memory/watchdog/monitor/heap_fragmentation.rb', line 14 def initialize(max_heap_fragmentation:) @max_heap_fragmentation = max_heap_fragmentation init_frag_limit_metrics end |
Instance Attribute Details
#max_heap_fragmentation ⇒ Object (readonly)
Returns the value of attribute max_heap_fragmentation.
10 11 12 |
# File 'lib/gitlab/memory/watchdog/monitor/heap_fragmentation.rb', line 10 def max_heap_fragmentation @max_heap_fragmentation end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/gitlab/memory/watchdog/monitor/heap_fragmentation.rb', line 19 def call heap_fragmentation = Gitlab::Metrics::Memory.gc_heap_fragmentation return { threshold_violated: false, payload: {} } if heap_fragmentation <= max_heap_fragmentation { threshold_violated: true, payload: payload(heap_fragmentation) } end |