Sha256: accc96e1267e1fdea0d76358fe16e07be4122d9713b9cfdf71b5b251e0255826
Contents?: true
Size: 1.44 KB
Versions: 18
Compression:
Stored size: 1.44 KB
Contents
module Appsignal class Hooks module SequelLogExtension # Add query instrumentation def log_yield(sql, args = nil) Appsignal.instrument( 'sql.sequel', nil, sql, Appsignal::EventFormatter::SQL_BODY_FORMAT ) do yield end end end module SequelLogConnectionExtension # Add query instrumentation def log_connection_yield(sql, conn, args = nil) Appsignal.instrument( 'sql.sequel', nil, sql, Appsignal::EventFormatter::SQL_BODY_FORMAT ) do yield end end end class SequelHook < Appsignal::Hooks::Hook register :sequel def dependencies_present? defined?(::Sequel::Database) && Appsignal.config && Appsignal.config[:instrument_sequel] end def install # Register the extension... if ::Sequel::MAJOR >= 4 && ::Sequel::MINOR >= 35 ::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) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems