Sha256: 141b07786d10bf266342fb92a38475280b5c6546c9ffb355f0e81469ab55e353

Contents?: true

Size: 631 Bytes

Versions: 4

Compression:

Stored size: 631 Bytes

Contents

require 'active_support/notifications'

ActiveSupport::Notifications.subscribe(/\.active_record$/) do |event, started, finished, _, payload|

  binds =
    (payload[:binds] || []).map do |column, value|
      if column
        if column.binary?
          value = "<#{value.bytesize} bytes of binary data>"
        end
        [column.name, value]
      else
        [nil, value]
      end
    end.inspect

  payload = {
    sql:      payload[:sql],
    binds:    binds,
    name:     payload[:name],
    duration: payload[:duration]
  }

  Vx::Lib::Instrumentation.delivery event, payload, event.split("."), started, finished
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vx-lib-instrumentation-0.1.12 lib/vx/lib/instrumentation/probe/active_record.rb
vx-lib-instrumentation-0.1.11 lib/vx/lib/instrumentation/probe/active_record.rb
vx-lib-instrumentation-0.1.10 lib/vx/lib/instrumentation/probe/active_record.rb
vx-lib-instrumentation-0.1.9 lib/vx/lib/instrumentation/probe/active_record.rb