Class: Skylight::Probes::Sequel::Probe Private
- Defined in:
- lib/skylight/probes/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
- #install ⇒ Object private
Instance Method Details
#install ⇒ Object
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.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/skylight/probes/sequel.rb', line 6 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 |