Sha256: 121c3cb908b13e224b4b5797b7d8231a7cbe41ad0f85c652edf3305a901b5284

Contents?: true

Size: 798 Bytes

Versions: 2

Compression:

Stored size: 798 Bytes

Contents

require 'elasticsearch'
require 'active_support'

module Appsignal
  module Elasticsearch
    module Instrumentation
      def perform_request_with_appsignal_instrumentation(method, path, params, body, &block)
        args = { method: method, path: path, params: params, body: body }
        ActiveSupport::Notifications.instrument(
          'query.elasticsearch', :query => args) do
            perform_request_without_appsignal_instrumentation(method, path, params, body, &block)
          end
      end

    end
  end
end

::Elasticsearch::Transport::Client.class_eval do
  include Appsignal::Elasticsearch::Instrumentation

  alias_method :perform_request_without_appsignal_instrumentation, :perform_request
  alias_method :perform_request, :perform_request_with_appsignal_instrumentation
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
appsignal-elasticsearch-0.0.3 lib/appsignal/elasticsearch/instrumentation.rb
appsignal-elasticsearch-0.0.2 lib/appsignal/elasticsearch/instrumentation.rb