Class: Metrics::Reporter
- Inherits:
-
Object
- Object
- Metrics::Reporter
- Includes:
- Logging
- Defined in:
- lib/ruby-metrics/reporter.rb
Constant Summary collapse
- DEFAULT_REPORTING_DELAY =
Default reporting delay is 60 seconds
60
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Reporter
constructor
A new instance of Reporter.
- #stop ⇒ Object
Methods included from Logging
Constructor Details
#initialize(options = {}) ⇒ Reporter
Returns a new instance of Reporter.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ruby-metrics/reporter.rb', line 12 def initialize( = {}) @running = true if [:agent] == nil raise "Need an agent to report data from" end delay = [:delay] || DEFAULT_REPORTING_DELAY agent = [:agent] Thread.new { while @running agent.reporters.each do |name, service| service.report(agent) end sleep delay end } end |
Instance Method Details
#stop ⇒ Object
8 9 10 |
# File 'lib/ruby-metrics/reporter.rb', line 8 def stop @running = false end |