Module: God::Conditions::ConditionHelper

Included in:
HttpResponseCode, Lambda, Ping
Defined in:
lib/god/conditions/condition_helper.rb

Instance Method Summary collapse

Instance Method Details

#timeline_test(res) ⇒ Object

check the result in the timeline..



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/god/conditions/condition_helper.rb', line 7

def timeline_test(res)
  self.trigger_on = true if self.trigger_on.nil?
  @timeline << res
  history = " - TRIGGER RATE: [#{@timeline.select { |x| x==self.trigger_on }.size}/#{@timeline.length}]"
  if @timeline.select { |x| x == self.trigger_on }.size >= self.times[0]
    status = trigger_on ? "UP" : "DOWN"
    self.info = " SERVICE STATUS moved to: #{status}"
    return true
  else
    self.info = " PASSED #{history}"
    return false
  end
end