Class: Monitors::ViolationsRecorders::Base

Inherits:
Object
  • Object
show all
Extended by:
Logging
Defined in:
lib/monitors/violations_recorders/base.rb

Direct Known Subclasses

Memory, Processes, ResponseTime

Class Method Summary collapse

Methods included from Logging

log, logger

Class Method Details

.inherited(base) ⇒ Object



12
13
14
# File 'lib/monitors/violations_recorders/base.rb', line 12

def inherited(base)
  base.instance_variable_set(:@violations, {})
end

.is_violating?(process) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
28
29
# File 'lib/monitors/violations_recorders/base.rb', line 22

def is_violating?(process)
  log "checking #{process}", :debug
  update_violations_count(process)
  log "#{@violations}", :debug
  violating = @violations[process.send(process_attr)] == retries_limit
  @violations[process.send(process_attr)] = 0 if violating
  violating
end

.resetObject



18
19
20
# File 'lib/monitors/violations_recorders/base.rb', line 18

def reset
  @violations = {}
end