Permalink
Browse files

use attr_reader for testing

  • Loading branch information...
1 parent aebf50e commit 7b4ff17efa4d8c62bd2e0956ea9e472381d8ea0e @kornypoet kornypoet committed Feb 18, 2014
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/goliath/chimp/plugins/activity_monitor.rb
View
10 lib/goliath/chimp/plugins/activity_monitor.rb
@@ -2,6 +2,8 @@ module Goliath::Chimp
module Plugin
class ActivityMonitor
+ attr_reader :logger, :status, :previous
+
def initialize(address, port, config, status, logger)
@status = status
@logger = logger
@@ -12,23 +14,23 @@ def run(options = {})
interval = options[:window] || 60
EM::Synchrony.add_periodic_timer(interval) do
current = latency
- @status[:reactor] = {
+ status[:reactor] = {
latency: current,
ratio: (current / interval).round(6),
}
- report @status
+ report status
end
end
def latency
snapshot = Time.now.to_f
- laten = snapshot - @previous
+ laten = snapshot - previous
@previous = snapshot
laten
end
def report metric
- @logger.debug metric
+ logger.debug metric
end
end
end

0 comments on commit 7b4ff17

Please sign in to comment.