Sha256: 739199113327bd6a448efaba907be6697d0afe5f0e5002c6e0572d52fdb351d6

Contents?: true

Size: 616 Bytes

Versions: 19

Compression:

Stored size: 616 Bytes

Contents

require 'sequel/database/logging'
require 'active_support/notifications'

module Sequel
  class Database
    def log_yield_with_instrumentation(sql, args = nil, &block)
      ActiveSupport::Notifications.instrument(
        'sql.rom',
        sql: sql,
        name: instrumentation_name,
        binds: args
      ) do
        log_yield_without_instrumentation(sql, args, &block)
      end
    end

    alias_method :log_yield_without_instrumentation, :log_yield
    alias_method :log_yield, :log_yield_with_instrumentation

    private

    def instrumentation_name
      "ROM[#{database_type}]"
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
rom-sql-0.7.0 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.7.0.rc1 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.7.0.beta1 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.6.1 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.6.0 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.6.0.rc1 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.6.0.beta1 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.5.3 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.5.2 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.5.1 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.5.0 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.4.3 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.4.1 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.4.0 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.4.0.rc1 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.4.0.beta2 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.4.0.beta1 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.3.2 lib/rom/sql/support/active_support_notifications.rb
rom-sql-0.3.1 lib/rom/sql/support/active_support_notifications.rb