Sha256: 84e3fb2f8fcb00328221c80279aeba26f732f1038d8339880ad626b299f30afe

Contents?: true

Size: 847 Bytes

Versions: 8

Compression:

Stored size: 847 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

8 entries across 8 versions & 1 rubygems

Version Path
skylight-5.1.0.beta lib/skylight/probes/sequel.rb
skylight-5.0.1 lib/skylight/probes/sequel.rb
skylight-5.0.0 lib/skylight/probes/sequel.rb
skylight-5.0.0.beta5 lib/skylight/probes/sequel.rb
skylight-5.0.0.beta4 lib/skylight/probes/sequel.rb
skylight-5.0.0.beta3 lib/skylight/probes/sequel.rb
skylight-5.0.0.beta2 lib/skylight/probes/sequel.rb
skylight-5.0.0.beta lib/skylight/probes/sequel.rb