Module: Instrumentable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/instrumentable.rb,
lib/instrumentable/version.rb
Overview
Instrumentable is a module you can include in your classes to help with setting up instrumention with ActiveSupport::Notifications.instrument Commoningly you would use ActiveSupport::Notifications.instrument and wrap it around the code you want you care about in order to fire off the approiate event. This allows you to do the same thing but without having to modify your existing method definitions.
==== Example
class Person
include Instrumentable
attr_reader :phone
def call
puts "Calling at #{@phone} number"
end
def self.find(id)
PersonStore.find(id)
end
instrument_method :call, 'person.call', :phone => :phone
class_instrument_method :find, 'person.find'
end
person = Person.find(5)
person.call
Result:
An event with name 'person.find' would fire when `Person.find` is called
with a payload of { :_method_args => 5 }
An event with name 'person.call' would fire when person.call is called
with a payload of { :phone => (555)555-555 }
Defined Under Namespace
Modules: ClassMethods Classes: Instrumentality
Constant Summary collapse
- VERSION =
"1.1.0"