Sha256: 4f2a5c840ed701768f69d6c2304b7a0996931ce6b10d752b422c80de493a6d10

Contents?: true

Size: 782 Bytes

Versions: 20

Compression:

Stored size: 782 Bytes

Contents

# Supports 3.12.0+
module Skylight
  module Probes
    module Sequel
      class Probe
        def install
          require "sequel/database/logging"

          method_name = ::Sequel::Database.method_defined?(:log_connection_yield) ? "log_connection_yield" : "log_yield"

          mod =
            Module.new do
              define_method method_name do |sql, *args, &block|
                super(sql, *args) do
                  ::ActiveSupport::Notifications.instrument("sql.sequel", sql: sql, name: "SQL", binds: args) do
                    block.call
                  end
                end
              end
            end

          ::Sequel::Database.prepend(mod)
        end
      end
    end

    register(:sequel, "Sequel", "sequel", Sequel::Probe.new)
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
skylight-6.1.0.beta lib/skylight/probes/sequel.rb
skylight-6.0.4 lib/skylight/probes/sequel.rb
skylight-6.0.3 lib/skylight/probes/sequel.rb
skylight-5.3.5 lib/skylight/probes/sequel.rb
skylight-6.0.2 lib/skylight/probes/sequel.rb
skylight-6.0.1 lib/skylight/probes/sequel.rb
skylight-6.0.0 lib/skylight/probes/sequel.rb
skylight-6.0.0.beta2 lib/skylight/probes/sequel.rb
skylight-6.0.0.beta lib/skylight/probes/sequel.rb
skylight-5.3.4 lib/skylight/probes/sequel.rb
skylight-5.3.3 lib/skylight/probes/sequel.rb
skylight-5.3.2 lib/skylight/probes/sequel.rb
skylight-5.3.1 lib/skylight/probes/sequel.rb
skylight-5.3.0 lib/skylight/probes/sequel.rb
skylight-5.2.0 lib/skylight/probes/sequel.rb
skylight-5.2.0.beta2 lib/skylight/probes/sequel.rb
skylight-5.2.0.beta lib/skylight/probes/sequel.rb
skylight-5.1.1 lib/skylight/probes/sequel.rb
skylight-5.1.0.beta3 lib/skylight/probes/sequel.rb
skylight-5.1.0.beta2 lib/skylight/probes/sequel.rb