Class: Instana::Activators::Bunny

Inherits:
Instana::Activator show all
Defined in:
lib/instana/activators/bunny.rb

Instance Method Summary collapse

Methods inherited from Instana::Activator

call, #call, inherited, start

Instance Method Details

#can_instrument?Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
# File 'lib/instana/activators/bunny.rb', line 6

def can_instrument?
  defined?(::Bunny) &&
    defined?(::Bunny::Queue) &&
    defined?(::Bunny::Exchange) &&
    ::Instana.config[:bunny][:enabled]
end

#instrumentObject



13
14
15
16
17
18
19
20
# File 'lib/instana/activators/bunny.rb', line 13

def instrument
  require 'instana/instrumentation/bunny'

  ::Bunny::Exchange.prepend(::Instana::Instrumentation::BunnyProducer)
  ::Bunny::Queue.prepend(::Instana::Instrumentation::BunnyConsumer)

  true
end