Class: Mnemosyne::Probe

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/mnemosyne/probe.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logging

#logger

Class Method Details

.subscribe(name) ⇒ Object



31
32
33
# File 'lib/mnemosyne/probe.rb', line 31

def subscribe(name)
  subscriptions << name
end

.subscriptionsObject



27
28
29
# File 'lib/mnemosyne/probe.rb', line 27

def subscriptions
  @subscriptions ||= Set.new
end

Instance Method Details

#installObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mnemosyne/probe.rb', line 7

def install
  setup

  self.class.subscriptions.each do |subscribe|
    ::ActiveSupport::Notifications.subscribe(subscribe) do |*args|
      trace = ::Mnemosyne::Instrumenter.current_trace
      next unless trace

      call(trace, *args)
    end
  end

  logger.debug(Mnemosyne) { "Installed probe #{self.class.name}" }
end

#setupObject



22
23
24
# File 'lib/mnemosyne/probe.rb', line 22

def setup
  # noop
end