Class: Monitors::ViolationsRecorders::ResponseTime

Inherits:
Base
  • Object
show all
Defined in:
lib/monitors/violations_recorders/response_time.rb

Class Method Summary collapse

Methods inherited from Base

inherited, is_violating?, reset

Methods included from Logging

#log, #logger

Class Method Details

.process_attrObject



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

def process_attr
  :pid
end

.process_is_violating?(process) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/monitors/violations_recorders/response_time.rb', line 16

def process_is_violating?(process)
  time = Cfg.response_time_threshold 
  begin 
    Timeout.timeout(Cfg.response_time_threshold) do 
      time = check_response_time(process)
    end
  rescue Timeout::Error
    return true
  end
  time > Cfg.response_time_threshold
end

.retries_limitObject



8
9
10
# File 'lib/monitors/violations_recorders/response_time.rb', line 8

def retries_limit
  Cfg.response_time_check_retries
end