Sha256: df16ca6aa2cd37b4cf299bffefd5ab60c52aaf19e1a49da7d355a40004c9bd50

Contents?: true

Size: 563 Bytes

Versions: 4

Compression:

Stored size: 563 Bytes

Contents

module HeimdallApm
  module ActiveRecord
    class Subscriber
      def start(name, id, payload)
        txn     = ::HeimdallApm::TransactionManager.current
        segment = ::HeimdallApm::Segment.new('Sql'.freeze, name)
        segment.data = payload[:sql]

        txn.start_segment(segment)
      end

      def finish(name, id, payload)
        txn = ::HeimdallApm::TransactionManager.current
        txn.stop_segment
      end
    end
  end
end

ActiveSupport::Notifications.subscribe(
  'sql.active_record',
  ::HeimdallApm::ActiveRecord::Subscriber.new
)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
heimdall_apm-0.1.3 lib/heimdall_apm/instruments/active_record.rb
heimdall_apm-0.1.2 lib/heimdall_apm/instruments/active_record.rb
heimdall_apm-0.1.1 lib/heimdall_apm/instruments/active_record.rb
heimdall_apm-0.1.0 lib/heimdall_apm/instruments/active_record.rb