lib/new_relic/agent/instrumentation/mongo.rb in newrelic_rpm-4.1.0.333 vs lib/new_relic/agent/instrumentation/mongo.rb in newrelic_rpm-4.2.0.334

- old
+ new

@@ -54,14 +54,14 @@ target_class.class_eval do include NewRelic::Agent::MethodTracer # It's key that this method eats all exceptions, as it rests between the # Mongo operation the user called and us returning them the data. Be safe! - def new_relic_notice_statement(t0, payload, name) + def new_relic_notice_statement(segment, payload, name) statement = NewRelic::Agent::Datastores::Mongo::StatementFormatter.format(payload, name) if statement - NewRelic::Agent.instance.transaction_sampler.notice_nosql_statement(statement, (Time.now - t0).to_f) + segment.notice_nosql_statement statement end rescue => e NewRelic::Agent.logger.debug("Exception during Mongo statement gathering", e) end @@ -83,11 +83,11 @@ begin result = NewRelic::Agent.disable_all_tracing do instrument_without_new_relic_trace(name, payload, &block) end - new_relic_notice_statement(segment.start_time, payload, name) if segment + new_relic_notice_statement(segment, payload, name) if segment result ensure segment.finish if segment end end @@ -105,11 +105,11 @@ begin result = NewRelic::Agent.disable_all_tracing do save_without_new_relic_trace(doc, opts, &block) end - new_relic_notice_statement(segment.start_time, doc, :save) if segment + new_relic_notice_statement(segment, doc, :save) if segment result ensure segment.finish if segment end end @@ -136,10 +136,10 @@ { spec => 1 } else spec.dup end - new_relic_notice_statement(segment.start_time, spec, :ensureIndex) if segment + new_relic_notice_statement(segment, spec, :ensureIndex) if segment result ensure segment.finish if segment end end