Class: Skylight::Core::Probes::Sequel::Probe Private

Inherits:
Object
  • Object
show all
Defined in:
lib/skylight/core/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

Instance Method Details

#installObject

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
24
25
26
27
# File 'lib/skylight/core/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'

  ::Sequel::Database.class_eval "    alias \#{method_name}_without_sk \#{method_name}\n\n    def \#{method_name}(sql, *args, &block)\n      \#{method_name}_without_sk(sql, *args) do\n        ::ActiveSupport::Notifications.instrument(\n          \"sql.sequel\",\n          sql: sql,\n          name: \"SQL\",\n          binds: args\n        ) do\n          block.call\n        end\n      end\n    end\n  end_eval\nend\n"