Skip to content

Instantly share code, notes, and snippets.

@kzk
Created March 29, 2012 05:10
Show Gist options
  • Save kzk/2233547 to your computer and use it in GitHub Desktop.
Save kzk/2233547 to your computer and use it in GitHub Desktop.
a.rb
# Scribe input
<source>
type scribe
port 1463
</source>
# match tag=debug.** and dump to console
<match debug.**>
type null
</match>
require 'thrift'
$:.unshift File.join(File.dirname(__FILE__), './lib/fluent/plugin/thrift')
require 'fb303_types'
require 'fb303_constants'
require 'facebook_service'
require 'scribe_types'
require 'scribe_constants'
require 'scribe'
host = 'localhost'
port = 1463
timeout = 10
100000.times { |i|
socket = Thrift::Socket.new host, port, timeout
transport = Thrift::FramedTransport.new socket
protocol = Thrift::BinaryProtocol.new transport, false, false
client = Scribe::Client.new protocol
transport.open
begin
entries = []
10.times {
entry = LogEntry.new
entry.category = 'debug.tag'
entry.message = 'message'.force_encoding('ASCII-8BIT')
entries << entry
}
client.Log(entries)
ensure
transport.close
end
if i % 1000 == 0
p GC.stat
h={}; ObjectSpace.each_object {|o| h[o.class] = (h[o.class] || 0) + 1 }; p h
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment