Class: DeliveryBoy::Instrumenter
- Inherits:
-
Object
- Object
- DeliveryBoy::Instrumenter
- Defined in:
- lib/delivery_boy/instrumenter.rb
Constant Summary collapse
- NAMESPACE =
"delivery_boy"
Instance Method Summary collapse
-
#initialize(default_payload: {}) ⇒ Instrumenter
constructor
A new instance of Instrumenter.
- #instrument(event_name, payload = {}, &block) ⇒ Object
Constructor Details
#initialize(default_payload: {}) ⇒ Instrumenter
Returns a new instance of Instrumenter.
7 8 9 10 |
# File 'lib/delivery_boy/instrumenter.rb', line 7 def initialize(default_payload: {}) require "active_support/notifications" @default_payload = default_payload end |
Instance Method Details
#instrument(event_name, payload = {}, &block) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/delivery_boy/instrumenter.rb', line 12 def instrument(event_name, payload = {}, &block) ActiveSupport::Notifications.instrument( "#{event_name}.#{NAMESPACE}", @default_payload.merge(payload), &block ) end |