Module: Elastics::ActiveRecord::Instrumentation

Defined in:
lib/elastics/active_record/instrumentation.rb

Overview

To be included in ‘Elastics::Client`

Defined Under Namespace

Modules: Fallback

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.installObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/elastics/active_record/instrumentation.rb', line 6

def install
  if Client.respond_to?(:prepend)
    Client.prepend self
  else
    Client.send :include, Fallback
  end
  unless ::ActiveRecord::LogSubscriber < LogSubscriber
    ::ActiveRecord::LogSubscriber.send :include, LogSubscriber
  end
end

Instance Method Details

#http_request(*args) ⇒ Object



18
19
20
21
22
# File 'lib/elastics/active_record/instrumentation.rb', line 18

def http_request(*args)
  ActiveSupport::Notifications.instrument 'request_elastics.active_record', args: args do
    super
  end
end