Module: Deimos::Instrumentation::ClassMethods

Defined in:
lib/deimos/instrumentation.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#instrument(event, extra = {}) ⇒ Object

:nodoc:



28
29
30
31
32
# File 'lib/deimos/instrumentation.rb', line 28

def instrument(event, extra={})
  ActiveSupport::Notifications.instrument("#{NAMESPACE}.#{event}", extra) do |extra2|
    yield(extra2) if block_given?
  end
end

#subscribe(event) ⇒ Object

:nodoc:



16
17
18
19
20
# File 'lib/deimos/instrumentation.rb', line 16

def subscribe(event)
  ActiveSupport::Notifications.subscribe("#{NAMESPACE}.#{event}") do |*args|
    yield(ActiveSupport::Notifications::Event.new(*args)) if block_given?
  end
end

#unsubscribe(subscriber) ⇒ Object

:nodoc:



23
24
25
# File 'lib/deimos/instrumentation.rb', line 23

def unsubscribe(subscriber)
  ActiveSupport::Notifications.unsubscribe(subscriber)
end