Module: NewRelic::Agent::Instrumentation::Mongodb

Defined in:
lib/newrelic_mongodb/instrumentation.rb

Instance Method Summary collapse

Instance Method Details

#logging_with_newrelic_trace(messages, operation_id = nil) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/newrelic_mongodb/instrumentation.rb', line 29

def logging_with_newrelic_trace(messages, operation_id = nil)
  operation_name, collection_name = determine_operation_and_collection(messages.first)

  NewRelic::Agent::Datastores.wrap('MongoDB', operation_name, collection_name, ->(result, metric, elapsed){ NewRelic::Agent::Datastores.notice_statement(operation_name, elapsed) }) do
    logging_without_newrelic_trace(messages, operation_id)
  end
end