Module: Deimos::Instrumentation::ClassMethods

Defined in:
lib/deimos/instrumentation.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

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

This method returns an undefined value.

Parameters:

  • event (String)
  • extra (Hash) (defaults to: {})


34
35
36
37
38
# File 'lib/deimos/instrumentation.rb', line 34

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

#subscribe(event) ⇒ void

This method returns an undefined value.

Parameters:

  • event (String)


19
20
21
22
23
# File 'lib/deimos/instrumentation.rb', line 19

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

#unsubscribe(subscriber) ⇒ void

This method returns an undefined value.

Parameters:

  • subscriber (ActiveSupport::Subscriber)


27
28
29
# File 'lib/deimos/instrumentation.rb', line 27

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