Sha256: 3dd2e9535d8c4209995d63b6188a3e2dfe97df4ab905eaa69e372d5397b69b1a
Contents?: true
Size: 773 Bytes
Versions: 42
Compression:
Stored size: 773 Bytes
Contents
#!/usr/bin/env ruby require 'redis' require 'oj' Oj.default_options = { :indent => 0, :mode => :strict } id = "%.2d" % (1..10).to_a[rand(9)] events = [] events << { 'entity' => "app-#{id}", 'check' => 'http', 'type' => 'service', 'state' => 'critical', 'summary' => "It's failing, yo!", 'timestamp' => Time.now.to_i, }.to_json redis = Redis.new 2000.times do events.each {|event| redis.rpush 'events', event } end puts "#{Time.now} - finished loading up events" previous_events_size = redis.llen 'events' while previous_events_size > 0 sleep 1 events_size = redis.llen 'events' throughput = previous_events_size - events_size previous_events_size = events_size puts "#{Time.now} - #{events_size} (#{throughput})" end
Version data entries
42 entries across 42 versions & 1 rubygems