Module: Phobos::Instrumentation
- Included in:
- Actions::ProcessBatch, Actions::ProcessMessage, Executor, Listener
- Defined in:
- lib/phobos/instrumentation.rb
Constant Summary collapse
- NAMESPACE =
'phobos'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.subscribe(event) ⇒ Object
7 8 9 10 11 |
# File 'lib/phobos/instrumentation.rb', line 7 def self.subscribe(event) ActiveSupport::Notifications.subscribe("#{NAMESPACE}.#{event}") do |*args| yield ActiveSupport::Notifications::Event.new(*args) if block_given? end end |
.unsubscribe(subscriber) ⇒ Object
13 14 15 |
# File 'lib/phobos/instrumentation.rb', line 13 def self.unsubscribe(subscriber) ActiveSupport::Notifications.unsubscribe(subscriber) end |
Instance Method Details
#instrument(event, extra = {}) ⇒ Object
17 18 19 20 21 |
# File 'lib/phobos/instrumentation.rb', line 17 def instrument(event, extra = {}) ActiveSupport::Notifications.instrument("#{NAMESPACE}.#{event}", extra) do |extra| yield(extra) if block_given? end end |