Sha256: df92f6c70dbd2501aa8aaa10030b931e0bf4c1945a738072b8002c5626899178

Contents?: true

Size: 553 Bytes

Versions: 33

Compression:

Stored size: 553 Bytes

Contents

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

module ROM
  module SQL
    module ActiveSupportInstrumentation
      def log_connection_yield(sql, _conn, args = nil)
        ActiveSupport::Notifications.instrument(
          'sql.rom',
          sql: sql,
          name: instrumentation_name,
          binds: args
        ) { super }
      end

      private

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

Sequel::Database.send(:prepend, ROM::SQL::ActiveSupportInstrumentation)

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
rom-sql-1.2.2 lib/rom/sql/extensions/active_support_notifications.rb
rom-sql-1.2.1 lib/rom/sql/extensions/active_support_notifications.rb
rom-sql-1.2.0 lib/rom/sql/extensions/active_support_notifications.rb
rom-sql-1.1.2 lib/rom/sql/extensions/active_support_notifications.rb
rom-sql-1.1.1 lib/rom/sql/extensions/active_support_notifications.rb
rom-sql-1.1.0 lib/rom/sql/extensions/active_support_notifications.rb
rom-sql-1.0.3 lib/rom/sql/extensions/active_support_notifications.rb
rom-sql-1.0.2 lib/rom/sql/extensions/active_support_notifications.rb
rom-sql-1.0.1 lib/rom/sql/extensions/active_support_notifications.rb
rom-sql-1.0.0 lib/rom/sql/extensions/active_support_notifications.rb
rom-sql-1.0.0.rc2 lib/rom/sql/extensions/active_support_notifications.rb
rom-sql-1.0.0.rc1 lib/rom/sql/extensions/active_support_notifications.rb
rom-sql-1.0.0.beta3 lib/rom/sql/extensions/active_support_notifications.rb