Skip to content

Instantly share code, notes, and snippets.

@bkerley
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bkerley/73e21ed7af26e609c6e7 to your computer and use it in GitHub Desktop.
Save bkerley/73e21ed7af26e609c6e7 to your computer and use it in GitHub Desktop.
require 'riak'
require 'instrumentable'
require 'pp'
c = Riak::Client.new pb_port: 17017
class Riak::Client
include Instrumentable
instrument_method :get_object, 'get_object'
instrument_method :store_object, 'store_object'
end
ActiveSupport::Notifications.subscribe('get_object') do |*args|
pp args
end
ActiveSupport::Notifications.subscribe('store_object') do |*args|
pp args
end
b = c['instrumentation_spike']
100.times do |t|
o = Riak::RObject.new b, t.to_s
o.data = t.to_s
o.content_type = 'text/plain'
o.store
o2 = b.get t.to_s
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment