Class: Appsignal::Hooks::MongoRubyDriverHook

Inherits:
Hook
  • Object
show all
Defined in:
lib/appsignal/hooks/mongo_ruby_driver.rb

Instance Method Summary collapse

Methods inherited from Hook

#installed?, register, #try_to_install

Instance Method Details

#dependencies_present?Boolean

Returns:

  • (Boolean)

6
7
8
# File 'lib/appsignal/hooks/mongo_ruby_driver.rb', line 6

def dependencies_present?
  defined?(::Mongo::Monitoring::Global)
end

#installObject


10
11
12
13
14
15
16
17
# File 'lib/appsignal/hooks/mongo_ruby_driver.rb', line 10

def install
  require 'appsignal/integrations/mongo_ruby_driver'

  Mongo::Monitoring::Global.subscribe(
    Mongo::Monitoring::COMMAND,
    Appsignal::Hooks::MongoMonitorSubscriber.new
  )
end