Sha256: 2567b240a14e2c00b44d10bd27c58fc9979d205c258cfb1e546b2dc12e717b0f

Contents?: true

Size: 575 Bytes

Versions: 4

Compression:

Stored size: 575 Bytes

Contents

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

        txn.start_segment(segment)
      end

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

ActiveSupport::Notifications.subscribe(
  'search.elasticsearch',
  ::HeimdallApm::Elasticsearch::Subscriber.new
)

Version data entries

4 entries across 4 versions & 1 rubygems

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