module NewRelic::Agent::Instrumentation::DataMapperInstrumentation

Public Instance Methods

log(msg) click to toggle source

Unlike in AR, log is called in DM after the query actually ran, complete with metrics. Since DO has already calculated the duration, there's nothing more to measure, so just record and log.

We rely on the assumption that all possible entry points have been hooked with tracers, ensuring that notice_sql attaches this SQL to the proper call scope.

Calls superclass method
# File lib/new_relic/agent/instrumentation/data_mapper.rb, line 173
def log(msg) #THREAD_LOCAL_ACCESS
  state = NewRelic::Agent::TransactionState.tl_get
  return unless state.is_execution_traced?

  duration = msg.duration / 1000000.0
  NewRelic::Agent.instance.transaction_sampler.notice_sql(msg.query, nil, duration, state)
ensure
  super
end