Class: Appsignal::Hooks::SequelHook Private

Inherits:
Hook show all
Defined in:
lib/appsignal/hooks/sequel.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Methods inherited from Hook

#initialize, #installed?, register, #try_to_install

Constructor Details

This class inherits a constructor from Appsignal::Hooks::Hook

Instance Method Details

#dependencies_present?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


37
38
39
40
41
# File 'lib/appsignal/hooks/sequel.rb', line 37

def dependencies_present?
  defined?(::Sequel::Database) &&
    Appsignal.config &&
    Appsignal.config[:instrument_sequel]
end

#installObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/appsignal/hooks/sequel.rb', line 43

def install
  # Register the extension...
  if (::Sequel::MAJOR >= 4 && ::Sequel::MINOR >= 35) || ::Sequel::MAJOR >= 5
    ::Sequel::Database.register_extension(
      :appsignal_integration,
      Appsignal::Hooks::SequelLogConnectionExtension
    )
  else
    ::Sequel::Database.register_extension(
      :appsignal_integration,
      Appsignal::Hooks::SequelLogExtension
    )
  end

  # ... and automatically add it to future instances.
  ::Sequel::Database.extension(:appsignal_integration)

  Appsignal::Environment.report_enabled("sequel")
end