Sha256: 0b6709a9f07c22c98428bfd1d239879f31e4b5123609a112607669a9b7541c5e

Contents?: true

Size: 550 Bytes

Versions: 2

Compression:

Stored size: 550 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
instrumental_agent-3.0.0.beta2 lib/instrumental/event_aggregator.rb
instrumental_agent-3.0.0.beta lib/instrumental/event_aggregator.rb