class Object

Public Instance Methods

__tracepath(path) click to toggle source
# File lib/elasticsearch_newrelic/instrumentation.rb, line 44
def __tracepath(path)
  v = path.split('/')[0]
  (v.nil? || v == '') ? path : v
end
perform_request_with_newrelic_trace(method, path, params={}, body=nil, headers=nil) click to toggle source
# File lib/elasticsearch_newrelic/instrumentation.rb, line 24
def perform_request_with_newrelic_trace(method, path, params={}, body=nil, headers=nil)
  return perform_request_without_newrelic_trace(method, path, params, body, headers) unless method == 'GET'

  result = nil
  callback = proc do |res, metric, elapsed|
    NewRelic::Agent::Datastores.notice_statement(body.inspect, elapsed)
    result = res
  end

  NewRelic::Agent::Datastores.wrap("Elasticsearch", "search", __tracepath(path), callback) do
    NewRelic::Agent.disable_all_tracing do
      perform_request_without_newrelic_trace(method, path, params, body, headers)
    end
  end
  result
end