Sha256: aca4bc54bce46b5000ebcb90badf319b7e4e834f472a1b2f425e42b237a1548f

Contents?: true

Size: 576 Bytes

Versions: 1

Compression:

Stored size: 576 Bytes

Contents

# frozen_string_literal: true

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.prepend ROM::SQL::ActiveSupportInstrumentation

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-sql-3.7.0 lib/rom/sql/extensions/active_support_notifications.rb