spec/benchmarks/set_session_level_serverhost_on_events.rb
# Generate random event with only single event having special server host attribute set which
# represents a worst case scenario since we need to backfill rest of the events.
Generate random event with only single event having special server host attribute set which
represents a worst case scenario since we need to backfill rest of the events.
Generate random event with only single event having special server host attribute set which represents a worst case scenario since we need to backfill rest of the events .
def generate_events(count)
  result = []
  ITERATIONS.times do |iteration|
    events = []
    count.times do |index|
      event = generate_hash([2])
      event[:attrs] = Hash.new
      event[:log] = 1
      if index == count - 1
        event[:attrs][EVENT_LEVEL_SERVER_HOST_ATTRIBUTE_NAME] = format("test-host-%s", index)
      end
      events << event
    end
    raise "Assertion failed" unless events.size == count
    result << events
  end
  raise "Assertion failed" unless result.size == ITERATIONS
  result
end
def generate_events ( count ) result = [ ] ITERATIONS . times do | iteration | events = [ ] count . times do | index | event = generate_hash ( [ 2 ] ) event [ :attrs ] = Hash . new event [ :log ] = 1 if index == count - 1 event [ :attrs ] [ EVENT_LEVEL_SERVER_HOST_ATTRIBUTE_NAME ] = format ( "test-host-%s" , index ) end events << event end raise "Assertion failed" unless events . size == count result << events end raise "Assertion failed" unless result . size == ITERATIONS result end
Generate random event with only single event having special server host attribute set which
represents a worst case scenario since we need to backfill rest of the events.
Generate random event with only single event having special server host attribute set which represents a worst case scenario since we need to backfill rest of the events .
count