resurrected_god 0.14.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +559 -0
  3. data/README.md +9 -4
  4. data/bin/god +26 -28
  5. data/ext/god/extconf.rb +9 -9
  6. data/lib/god/behavior.rb +3 -5
  7. data/lib/god/behaviors/clean_pid_file.rb +4 -6
  8. data/lib/god/behaviors/clean_unix_socket.rb +4 -6
  9. data/lib/god/behaviors/notify_when_flapping.rb +13 -15
  10. data/lib/god/cli/command.rb +109 -89
  11. data/lib/god/cli/run.rb +51 -75
  12. data/lib/god/cli/version.rb +2 -4
  13. data/lib/god/condition.rb +12 -14
  14. data/lib/god/conditions/always.rb +3 -2
  15. data/lib/god/conditions/complex.rb +23 -24
  16. data/lib/god/conditions/cpu_usage.rb +12 -16
  17. data/lib/god/conditions/degrading_lambda.rb +15 -19
  18. data/lib/god/conditions/disk_usage.rb +7 -8
  19. data/lib/god/conditions/file_mtime.rb +3 -7
  20. data/lib/god/conditions/file_touched.rb +4 -5
  21. data/lib/god/conditions/flapping.rb +57 -62
  22. data/lib/god/conditions/http_response_code.rb +27 -32
  23. data/lib/god/conditions/lambda.rb +3 -5
  24. data/lib/god/conditions/memory_usage.rb +12 -16
  25. data/lib/god/conditions/process_exits.rb +12 -12
  26. data/lib/god/conditions/process_running.rb +8 -10
  27. data/lib/god/conditions/socket_responding.rb +23 -28
  28. data/lib/god/conditions/tries.rb +12 -14
  29. data/lib/god/configurable.rb +7 -10
  30. data/lib/god/contact.rb +41 -52
  31. data/lib/god/contacts/airbrake.rb +10 -12
  32. data/lib/god/contacts/campfire.rb +18 -20
  33. data/lib/god/contacts/email.rb +27 -28
  34. data/lib/god/contacts/prowl.rb +16 -17
  35. data/lib/god/contacts/scout.rb +2 -5
  36. data/lib/god/contacts/sensu.rb +15 -11
  37. data/lib/god/contacts/slack.rb +23 -33
  38. data/lib/god/contacts/statsd.rb +8 -8
  39. data/lib/god/contacts/twitter.rb +2 -2
  40. data/lib/god/contacts/webhook.rb +21 -24
  41. data/lib/god/driver.rb +12 -18
  42. data/lib/god/errors.rb +0 -2
  43. data/lib/god/event_handler.rb +40 -49
  44. data/lib/god/event_handlers/dummy_handler.rb +1 -1
  45. data/lib/god/event_handlers/kqueue_handler.rb +2 -2
  46. data/lib/god/event_handlers/netlink_handler.rb +1 -1
  47. data/lib/god/logger.rb +5 -13
  48. data/lib/god/metric.rb +13 -15
  49. data/lib/god/process.rb +93 -98
  50. data/lib/god/simple_logger.rb +13 -15
  51. data/lib/god/socket.rb +21 -23
  52. data/lib/god/sugar.rb +8 -8
  53. data/lib/god/sys_logger.rb +6 -8
  54. data/lib/god/system/portable_poller.rb +1 -9
  55. data/lib/god/system/process.rb +4 -6
  56. data/lib/god/system/slash_proc_poller.rb +17 -19
  57. data/lib/god/task.rb +110 -136
  58. data/lib/god/timeline.rb +2 -4
  59. data/lib/god/trigger.rb +7 -11
  60. data/lib/god/version.rb +1 -1
  61. data/lib/god/watch.rb +51 -57
  62. data/lib/god.rb +122 -148
  63. metadata +17 -370
  64. data/Announce.txt +0 -135
  65. data/Gemfile +0 -5
  66. data/Rakefile +0 -129
  67. data/doc/god.asciidoc +0 -1592
  68. data/doc/intro.asciidoc +0 -20
  69. data/ext/god/.gitignore +0 -5
  70. data/lib/god/compat19.rb +0 -33
  71. data/lib/god/contacts/hipchat.rb +0 -117
  72. data/lib/god/contacts/jabber.rb +0 -75
  73. data/test/configs/child_events/child_events.god +0 -44
  74. data/test/configs/child_events/simple_server.rb +0 -3
  75. data/test/configs/child_polls/child_polls.god +0 -37
  76. data/test/configs/child_polls/simple_server.rb +0 -12
  77. data/test/configs/complex/complex.god +0 -59
  78. data/test/configs/complex/simple_server.rb +0 -3
  79. data/test/configs/contact/contact.god +0 -118
  80. data/test/configs/contact/simple_server.rb +0 -3
  81. data/test/configs/daemon_events/daemon_events.god +0 -37
  82. data/test/configs/daemon_events/simple_server.rb +0 -8
  83. data/test/configs/daemon_events/simple_server_stop.rb +0 -11
  84. data/test/configs/daemon_polls/daemon_polls.god +0 -17
  85. data/test/configs/daemon_polls/simple_server.rb +0 -6
  86. data/test/configs/degrading_lambda/degrading_lambda.god +0 -31
  87. data/test/configs/degrading_lambda/tcp_server.rb +0 -15
  88. data/test/configs/keepalive/keepalive.god +0 -9
  89. data/test/configs/keepalive/keepalive.rb +0 -12
  90. data/test/configs/lifecycle/lifecycle.god +0 -25
  91. data/test/configs/matias/matias.god +0 -50
  92. data/test/configs/real.rb +0 -59
  93. data/test/configs/running_load/running_load.god +0 -16
  94. data/test/configs/stop_options/simple_server.rb +0 -12
  95. data/test/configs/stop_options/stop_options.god +0 -39
  96. data/test/configs/stress/simple_server.rb +0 -3
  97. data/test/configs/stress/stress.god +0 -15
  98. data/test/configs/task/logs/.placeholder +0 -0
  99. data/test/configs/task/task.god +0 -26
  100. data/test/configs/test.rb +0 -61
  101. data/test/configs/usr1_trapper.rb +0 -10
  102. data/test/helper.rb +0 -172
  103. data/test/suite.rb +0 -6
  104. data/test/test_airbrake.rb +0 -14
  105. data/test/test_behavior.rb +0 -18
  106. data/test/test_campfire.rb +0 -22
  107. data/test/test_condition.rb +0 -52
  108. data/test/test_conditions_disk_usage.rb +0 -50
  109. data/test/test_conditions_http_response_code.rb +0 -109
  110. data/test/test_conditions_process_running.rb +0 -40
  111. data/test/test_conditions_socket_responding.rb +0 -176
  112. data/test/test_conditions_tries.rb +0 -67
  113. data/test/test_contact.rb +0 -109
  114. data/test/test_driver.rb +0 -26
  115. data/test/test_email.rb +0 -34
  116. data/test/test_event_handler.rb +0 -82
  117. data/test/test_god.rb +0 -710
  118. data/test/test_god_system.rb +0 -201
  119. data/test/test_handlers_kqueue_handler.rb +0 -16
  120. data/test/test_hipchat.rb +0 -23
  121. data/test/test_jabber.rb +0 -29
  122. data/test/test_logger.rb +0 -55
  123. data/test/test_metric.rb +0 -74
  124. data/test/test_process.rb +0 -263
  125. data/test/test_prowl.rb +0 -15
  126. data/test/test_registry.rb +0 -15
  127. data/test/test_sensu.rb +0 -11
  128. data/test/test_slack.rb +0 -57
  129. data/test/test_socket.rb +0 -34
  130. data/test/test_statsd.rb +0 -22
  131. data/test/test_sugar.rb +0 -42
  132. data/test/test_system_portable_poller.rb +0 -17
  133. data/test/test_system_process.rb +0 -30
  134. data/test/test_task.rb +0 -246
  135. data/test/test_timeline.rb +0 -37
  136. data/test/test_trigger.rb +0 -63
  137. data/test/test_watch.rb +0 -286
  138. data/test/test_webhook.rb +0 -22
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Send a notice to statsd
2
4
  #
3
5
  # host - statsd host
@@ -7,7 +9,6 @@ require 'statsd-ruby'
7
9
 
8
10
  module God
9
11
  module Contacts
10
-
11
12
  class Statsd < Contact
12
13
  class << self
13
14
  attr_accessor :host, :port
@@ -21,16 +22,16 @@ module God
21
22
  valid
22
23
  end
23
24
 
24
- def notify(message, time, priority, category, hostname)
25
+ def notify(message, _time, _priority, _category, hostname)
25
26
  statsd = ::Statsd.new host, (port ? port.to_i : 8125) # 8125 is the default statsd port
26
27
 
27
- hostname.gsub! /\./, '_'
28
- app = message.gsub /([^\s]*).*/, '\1'
28
+ hostname = hostname.tr('.', '_')
29
+ app = message.gsub(/([^\s]*).*/, '\1')
29
30
 
30
31
  [
31
- 'cpu out of bounds',
32
- 'memory out of bounds',
33
- 'process is flapping'
32
+ 'cpu out of bounds',
33
+ 'memory out of bounds',
34
+ 'process is flapping'
34
35
  ].each do |event_type|
35
36
  statsd.increment "god.#{event_type.gsub(/\s/, '_')}.#{hostname}.#{app}" if message.include? event_type
36
37
  end
@@ -41,6 +42,5 @@ module God
41
42
  applog(nil, :debug, e.backtrace.join("\n"))
42
43
  end
43
44
  end
44
-
45
45
  end
46
46
  end
@@ -35,13 +35,13 @@ module God
35
35
  attr_accessor :consumer_token, :consumer_secret,
36
36
  :access_token, :access_secret
37
37
 
38
- def notify(message, time, priority, category, host)
38
+ def notify(message, _time, _priority, _category, _host)
39
39
  oauth = ::Twitter::OAuth.new(arg(:consumer_token), arg(:consumer_secret))
40
40
  oauth.authorize_from_access(arg(:access_token), arg(:access_secret))
41
41
 
42
42
  ::Twitter::Base.new(oauth).update(message)
43
43
 
44
- self.info = "sent twitter update"
44
+ self.info = 'sent twitter update'
45
45
  rescue => e
46
46
  applog(nil, :info, "failed to send twitter update: #{e.message}")
47
47
  applog(nil, :debug, e.backtrace.join("\n"))
@@ -13,7 +13,6 @@ end
13
13
 
14
14
  module God
15
15
  module Contacts
16
-
17
16
  class Webhook < Contact
18
17
  class << self
19
18
  attr_accessor :url, :format
@@ -32,43 +31,41 @@ module God
32
31
 
33
32
  def notify(message, time, priority, category, host)
34
33
  data = {
35
- :message => message,
36
- :time => time,
37
- :priority => priority,
38
- :category => category,
39
- :host => host
34
+ message: message,
35
+ time: time,
36
+ priority: priority,
37
+ category: category,
38
+ host: host
40
39
  }
41
40
 
42
41
  uri = URI.parse(arg(:url))
43
42
  http = Net::HTTP.new(uri.host, uri.port)
44
- http.use_ssl = true if uri.scheme == "https"
45
-
46
- req = nil
47
- res = nil
43
+ http.use_ssl = true if uri.scheme == 'https'
48
44
 
49
45
  case arg(:format)
50
- when :form
51
- req = Net::HTTP::Post.new(uri.request_uri)
52
- req.set_form_data(data)
53
- when :json
54
- req = Net::HTTP::Post.new(uri.request_uri)
55
- req.body = data.to_json
46
+ when :form
47
+ req = Net::HTTP::Post.new(uri.request_uri)
48
+ req.set_form_data(data)
49
+ when :json
50
+ req = Net::HTTP::Post.new(uri.request_uri)
51
+ req.body = data.to_json
52
+ else
53
+ # This line is unreachable
54
+ raise 'Condition is invalid'
56
55
  end
57
56
 
58
57
  res = http.request(req)
59
58
 
60
- case res
61
- when Net::HTTPSuccess
62
- self.info = "sent webhook to #{arg(:url)}"
63
- else
64
- self.info = "failed to send webhook to #{arg(:url)}: #{res.error!}"
65
- end
59
+ self.info = case res
60
+ when Net::HTTPSuccess
61
+ "sent webhook to #{arg(:url)}"
62
+ else
63
+ "failed to send webhook to #{arg(:url)}: #{res.error!}"
64
+ end
66
65
  rescue Object => e
67
66
  applog(nil, :info, "failed to send webhook to #{arg(:url)}: #{e.message}")
68
67
  applog(nil, :debug, e.backtrace.join("\n"))
69
68
  end
70
-
71
69
  end
72
-
73
70
  end
74
71
  end
data/lib/god/driver.rb CHANGED
@@ -1,10 +1,5 @@
1
1
  require 'monitor'
2
2
 
3
- # Ruby 1.9.1 specific fixes.
4
- if RUBY_VERSION.between?('1.9', '1.9.1')
5
- require 'god/compat19'
6
- end
7
-
8
3
  module God
9
4
  # The TimedEvent class represents an event in the future. This class is used
10
5
  # by the drivers to schedule upcoming conditional tests and other scheduled
@@ -28,7 +23,7 @@ module God
28
23
  #
29
24
  # Returns true if the event is due, false if not.
30
25
  def due?
31
- Time.now >= self.at
26
+ Time.now >= at
32
27
  end
33
28
 
34
29
  # Compare this event to another.
@@ -38,7 +33,7 @@ module God
38
33
  # Returns -1 if this event is before the other, 0 if the two events are
39
34
  # due at the same time, 1 if the other event is later.
40
35
  def <=>(other)
41
- self.at <=> other.at
36
+ at <=> other.at
42
37
  end
43
38
  end
44
39
 
@@ -116,7 +111,8 @@ module God
116
111
  def pop
117
112
  @monitor.synchronize do
118
113
  if @events.empty?
119
- raise ThreadError, "queue empty" if @shutdown
114
+ raise ThreadError, 'queue empty' if @shutdown
115
+
120
116
  @resource.wait
121
117
  else
122
118
  delay = @events.first.at - Time.now
@@ -177,16 +173,14 @@ module God
177
173
 
178
174
  @thread = Thread.new do
179
175
  loop do
180
- begin
181
- @events.pop.handle_event
182
- rescue ThreadError => e
183
- # queue is empty
184
- break
185
- rescue Object => e
186
- message = format("Unhandled exception in driver loop - (%s): %s\n%s",
187
- e.class, e.message, e.backtrace.join("\n"))
188
- applog(nil, :fatal, message)
189
- end
176
+ @events.pop.handle_event
177
+ rescue ThreadError
178
+ # queue is empty
179
+ break
180
+ rescue Object => e
181
+ message = format("Unhandled exception in driver loop - (%{class}): %{message}\n%{backtrace}",
182
+ class: e.class, message: e.message, backtrace: e.backtrace.join("\n"))
183
+ applog(nil, :fatal, message)
190
184
  end
191
185
  end
192
186
  end
data/lib/god/errors.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  module God
2
-
3
2
  class AbstractMethodNotOverriddenError < StandardError
4
3
  end
5
4
 
@@ -20,5 +19,4 @@ module God
20
19
 
21
20
  class EventRegistrationFailedError < StandardError
22
21
  end
23
-
24
22
  end
@@ -13,23 +13,21 @@ module God
13
13
  end
14
14
 
15
15
  def self.load
16
- begin
17
- case RUBY_PLATFORM
18
- when /darwin/i, /bsd/i
19
- require 'god/event_handlers/kqueue_handler'
20
- @@handler = KQueueHandler
21
- when /linux/i
22
- require 'god/event_handlers/netlink_handler'
23
- @@handler = NetlinkHandler
24
- else
25
- raise NotImplementedError, "Platform not supported for EventHandler"
26
- end
27
- @@loaded = true
28
- rescue Exception
29
- require 'god/event_handlers/dummy_handler'
30
- @@handler = DummyHandler
31
- @@loaded = false
16
+ case RUBY_PLATFORM
17
+ when /darwin/i, /bsd/i
18
+ require 'god/event_handlers/kqueue_handler'
19
+ @@handler = KQueueHandler
20
+ when /linux/i
21
+ require 'god/event_handlers/netlink_handler'
22
+ @@handler = NetlinkHandler
23
+ else
24
+ raise NotImplementedError, 'Platform not supported for EventHandler'
32
25
  end
26
+ @@loaded = true
27
+ rescue Exception
28
+ require 'god/event_handlers/dummy_handler'
29
+ @@handler = DummyHandler
30
+ @@loaded = false
33
31
  end
34
32
 
35
33
  def self.register(pid, event, &block)
@@ -39,12 +37,12 @@ module God
39
37
  end
40
38
 
41
39
  def self.deregister(pid, event)
42
- if watching_pid? pid
43
- running = ::Process.kill(0, pid.to_i) rescue false
44
- @@actions[pid].delete(event)
45
- @@handler.register_process(pid, @@actions[pid].keys) if running
46
- @@actions.delete(pid) if @@actions[pid].empty?
47
- end
40
+ return unless watching_pid?(pid)
41
+
42
+ running = ::Process.kill(0, pid.to_i) rescue false
43
+ @@actions[pid].delete(event)
44
+ @@handler.register_process(pid, @@actions[pid].keys) if running
45
+ @@actions.delete(pid) if @@actions[pid].empty?
48
46
  end
49
47
 
50
48
  def self.call(pid, event, extra_data = {})
@@ -58,55 +56,48 @@ module God
58
56
  def self.start
59
57
  @@thread = Thread.new do
60
58
  loop do
61
- begin
62
- @@handler.handle_events
63
- rescue Exception => e
64
- message = format("Unhandled exception (%s): %s\n%s",
65
- e.class, e.message, e.backtrace.join("\n"))
66
- applog(nil, :fatal, message)
67
- end
59
+ @@handler.handle_events
60
+ rescue Exception => e
61
+ message = format("Unhandled exception (%{class}): %{message}\n%{backtrace}",
62
+ class: e.class, message: e.message, backtrace: e.backtrace.join("\n"))
63
+ applog(nil, :fatal, message)
68
64
  end
69
65
  end
70
66
 
71
67
  # do a real test to make sure events are working properly
72
- @@loaded = self.operational?
68
+ @@loaded = operational?
73
69
  end
74
70
 
75
71
  def self.stop
76
- @@thread.kill if @@thread
72
+ @@thread&.kill
77
73
  end
78
74
 
79
75
  def self.operational?
80
76
  com = [false]
81
77
 
82
78
  Thread.new do
83
- begin
84
- event_system = God::EventHandler.event_system
85
-
86
- pid = fork do
87
- loop { sleep(1) }
88
- end
79
+ pid = fork do
80
+ loop { sleep(1) }
81
+ end
89
82
 
90
- self.register(pid, :proc_exit) do
91
- com[0] = true
92
- end
83
+ register(pid, :proc_exit) do
84
+ com[0] = true
85
+ end
93
86
 
94
- ::Process.kill('KILL', pid)
95
- ::Process.waitpid(pid)
87
+ ::Process.kill('KILL', pid)
88
+ ::Process.waitpid(pid)
96
89
 
97
- sleep(0.1)
90
+ sleep(0.1)
98
91
 
99
- self.deregister(pid, :proc_exit) rescue nil
100
- rescue => e
101
- puts e.message
102
- puts e.backtrace.join("\n")
103
- end
92
+ deregister(pid, :proc_exit) rescue nil
93
+ rescue => e
94
+ puts e.message
95
+ puts e.backtrace.join("\n")
104
96
  end.join
105
97
 
106
98
  sleep(0.1)
107
99
 
108
100
  com.first
109
101
  end
110
-
111
102
  end
112
103
  end
@@ -1,6 +1,6 @@
1
1
  module God
2
2
  class DummyHandler
3
- EVENT_SYSTEM = "none"
3
+ EVENT_SYSTEM = 'none'.freeze
4
4
 
5
5
  def self.register_process(pid, events)
6
6
  raise NotImplementedError
@@ -2,7 +2,7 @@ require 'kqueue_handler_ext'
2
2
 
3
3
  module God
4
4
  class KQueueHandler
5
- EVENT_SYSTEM = "kqueue"
5
+ EVENT_SYSTEM = 'kqueue'.freeze
6
6
 
7
7
  def self.register_process(pid, events)
8
8
  monitor_process(pid, events_mask(events))
@@ -10,7 +10,7 @@ module God
10
10
 
11
11
  def self.events_mask(events)
12
12
  events.inject(0) do |mask, event|
13
- mask |= event_mask(event)
13
+ mask | event_mask(event)
14
14
  end
15
15
  end
16
16
  end
@@ -2,7 +2,7 @@ require 'netlink_handler_ext'
2
2
 
3
3
  module God
4
4
  class NetlinkHandler
5
- EVENT_SYSTEM = "netlink"
5
+ EVENT_SYSTEM = 'netlink'.freeze
6
6
 
7
7
  def self.register_process(pid, events)
8
8
  # netlink doesn't need to do this
data/lib/god/logger.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  module God
2
-
3
2
  class Logger < SimpleLogger
4
-
5
3
  attr_accessor :logs
6
4
 
7
5
  class << self
@@ -22,7 +20,6 @@ module God
22
20
  @templog.level = Logger::INFO
23
21
  end
24
22
 
25
-
26
23
  def level=(lev)
27
24
  SysLogger.level = SimpleLogger::CONSTANT_TO_SYMBOL[lev] if Logger.syslog
28
25
  super(lev)
@@ -36,7 +33,7 @@ module God
36
33
  # Returns nothing
37
34
  def log(watch, level, text)
38
35
  # initialize watch log if necessary
39
- self.logs[watch.name] ||= Timeline.new(God::LOG_BUFFER_SIZE_DEFAULT) if watch
36
+ logs[watch.name] ||= Timeline.new(God::LOG_BUFFER_SIZE_DEFAULT) if watch
40
37
 
41
38
  # push onto capture and timeline for the given watch
42
39
  if @capture || (watch && (Time.now - @spool < 2))
@@ -50,13 +47,13 @@ module God
50
47
  if @capture
51
48
  @capture.puts(message)
52
49
  else
53
- self.logs[watch.name] << [Time.now, message]
50
+ logs[watch.name] << [Time.now, message]
54
51
  end
55
52
  end
56
53
  end
57
54
 
58
55
  # send to regular logger
59
- self.send(level, text)
56
+ send(level, text)
60
57
 
61
58
  # send to syslog
62
59
  SysLogger.log(level, text) if Logger.syslog
@@ -69,16 +66,12 @@ module God
69
66
  # Returns String
70
67
  def watch_log_since(watch_name, since)
71
68
  # initialize watch log if necessary
72
- self.logs[watch_name] ||= Timeline.new(God::LOG_BUFFER_SIZE_DEFAULT)
69
+ logs[watch_name] ||= Timeline.new(God::LOG_BUFFER_SIZE_DEFAULT)
73
70
 
74
71
  # get and join lines since given time
75
72
  @mutex.synchronize do
76
73
  @spool = Time.now
77
- self.logs[watch_name].select do |x|
78
- x.first > since
79
- end.map do |x|
80
- x[1]
81
- end.join
74
+ logs[watch_name].select { |x| x.first > since }.map { |x| x[1] }.join
82
75
  end
83
76
  end
84
77
 
@@ -105,5 +98,4 @@ module God
105
98
  end
106
99
  end
107
100
  end
108
-
109
101
  end
data/lib/god/metric.rb CHANGED
@@ -32,7 +32,7 @@ module God
32
32
  def condition(kind)
33
33
  # Create the condition.
34
34
  begin
35
- c = Condition.generate(kind, self.watch)
35
+ c = Condition.generate(kind, watch)
36
36
  rescue NoSuchConditionError => e
37
37
  abort e.message
38
38
  end
@@ -44,24 +44,22 @@ module God
44
44
  c.prepare
45
45
 
46
46
  # Test generic and specific validity.
47
- unless Condition.valid?(c) && c.valid?
48
- abort "Exiting on invalid condition"
49
- end
47
+ abort 'Exiting on invalid condition' unless Condition.valid?(c) && c.valid?
50
48
 
51
49
  # Inherit interval from watch if no poll condition specific interval was
52
50
  # set.
53
- if c.kind_of?(PollCondition) && !c.interval
54
- if self.watch.interval
55
- c.interval = self.watch.interval
51
+ if c.is_a?(PollCondition) && !c.interval
52
+ if watch.interval
53
+ c.interval = watch.interval
56
54
  else
57
- abort "No interval set for Condition '#{c.class.name}' in Watch " +
58
- "'#{self.watch.name}', and no default Watch interval from " +
59
- "which to inherit."
55
+ abort "No interval set for Condition '#{c.class.name}' in Watch " \
56
+ "'#{watch.name}', and no default Watch interval from " \
57
+ 'which to inherit.'
60
58
  end
61
59
  end
62
60
 
63
61
  # Add the condition to the list.
64
- self.conditions << c
62
+ conditions << c
65
63
  end
66
64
 
67
65
  # Enable all of this Metric's conditions. Poll conditions will be
@@ -69,8 +67,8 @@ module God
69
67
  #
70
68
  # Returns nothing.
71
69
  def enable
72
- self.conditions.each do |c|
73
- self.watch.attach(c)
70
+ conditions.each do |c|
71
+ watch.attach(c)
74
72
  end
75
73
  end
76
74
 
@@ -79,8 +77,8 @@ module God
79
77
  #
80
78
  # Returns nothing.
81
79
  def disable
82
- self.conditions.each do |c|
83
- self.watch.detach(c)
80
+ conditions.each do |c|
81
+ watch.detach(c)
84
82
  end
85
83
  end
86
84
  end