Sha256: 0f5f04c3f3ca82e80831310d84738014d4b82b6865f83d1f4d589556cc7ca8f4

Contents?: true

Size: 1.04 KB

Versions: 24

Compression:

Stored size: 1.04 KB

Contents

module Appsignal
  class Hooks
    module SequelExtension
      # Add query instrumentation
      def log_yield(sql, args = nil)

        # We'd like to get full sql queries in the payloads as well. To do
        # that we need to find out a way to ask Sequel which quoting strategy
        # is used by the adapter. We can then do something similar to the AR
        # formatter.

        ActiveSupport::Notifications.instrument('sql.sequel') 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...
        ::Sequel::Database.register_extension(
          :appsignal_integration,
          Appsignal::Hooks::SequelExtension
        )

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

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
appsignal-1.0.4 lib/appsignal/hooks/sequel.rb
appsignal-1.1.0.beta.6 lib/appsignal/hooks/sequel.rb
appsignal-1.0.3 lib/appsignal/hooks/sequel.rb
appsignal-1.0.3.beta.2 lib/appsignal/hooks/sequel.rb
appsignal-1.0.3.beta.1 lib/appsignal/hooks/sequel.rb
appsignal-1.1.0.beta.5 lib/appsignal/hooks/sequel.rb
appsignal-1.1.0.beta.4 lib/appsignal/hooks/sequel.rb
appsignal-1.1.0.beta.3 lib/appsignal/hooks/sequel.rb
appsignal-1.1.0.beta.2 lib/appsignal/hooks/sequel.rb
appsignal-1.1.0.beta.1 lib/appsignal/hooks/sequel.rb
appsignal-1.0.2 lib/appsignal/hooks/sequel.rb
appsignal-1.0.2.beta.4 lib/appsignal/hooks/sequel.rb
appsignal-1.0.2.beta.3 lib/appsignal/hooks/sequel.rb
appsignal-1.0.2.beta.2 lib/appsignal/hooks/sequel.rb
appsignal-1.0.2.beta.1 lib/appsignal/hooks/sequel.rb
appsignal-1.0.1 lib/appsignal/hooks/sequel.rb
appsignal-1.0.0 lib/appsignal/hooks/sequel.rb
appsignal-1.0.0.rc.1 lib/appsignal/hooks/sequel.rb
appsignal-0.12.rc.14 lib/appsignal/hooks/sequel.rb
appsignal-0.12.rc.13 lib/appsignal/hooks/sequel.rb