Sha256: 2626d0a54d9dc23d50667360ff6118ad651594ef14018e9a69c723de75f0f302

Contents?: true

Size: 615 Bytes

Versions: 1

Compression:

Stored size: 615 Bytes

Contents

module Metrics
  class Reporter
    # Default reporting delay is 60 seconds
    DEFAULT_REPORTING_DELAY = 60

    include Logging

    def stop
      @running = false
    end

    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

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-metrics-0.9.4 lib/ruby-metrics/reporter.rb