class Metrics::Reporter

Constants

DEFAULT_REPORTING_DELAY

Default reporting delay is 60 seconds

Public Class Methods

new(options = {}) click to toggle source
# File lib/ruby-metrics/reporter.rb, line 12
def initialize(options = {})
  @running = true

  if options[:agent] == nil
    raise "Need an agent to report data from"
  end

  delay = options[:delay] || DEFAULT_REPORTING_DELAY
  agent = options[:agent] 

  Thread.new {
    while @running
      agent.reporters.each do |name, service|
        service.report(agent)
      end
      sleep delay
    end
  }
end

Public Instance Methods

stop() click to toggle source
# File lib/ruby-metrics/reporter.rb, line 8
def stop
  @running = false
end