Sha256: fc4b908b3bf95e4fd88a331e74dc80ab950d6cd33141f6c4e17ff7356b0ed087

Contents?: true

Size: 617 Bytes

Versions: 2

Compression:

Stored size: 617 Bytes

Contents

module Instrumental
  class EventAggregator
    attr_accessor :counts, :values, :received_at, :frequency

    def initialize(frequency:)
      @values = Hash.new
      @frequency = frequency
    end

    def put(command)
      command_at = command.time
      unless(command_at % frequency == 0)
        command.time = (command_at - (command_at % frequency))
      end
      metadata = command.metadata
      @values[metadata] = (command + @values[metadata])
    end

    def size
      @values.size
    end

    def coerce_time(time)
      itime = time.to_i
      (itime - (itime % frequency)).to_i
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
instrumental_agent-3.0.0 lib/instrumental/event_aggregator.rb
instrumental_agent-3.0.0.beta3 lib/instrumental/event_aggregator.rb