Method: TingYun::Agent#with_database_metric_name

Defined in:
lib/ting_yun/agent.rb

#with_database_metric_name(model, method = nil, product = nil, &block) ⇒ Object

Yield to a block that is run with a database metric name context. This means the Database instrumentation will use this for the metric name if it does not otherwise know about a model. This is re-entrant.

identify the operation with.

Parameters:

  • model (String, Class, #to_s)

    the DB model class

  • method (String) (defaults to: nil)

    the name of the finder method or other method to



104
105
106
107
108
109
110
# File 'lib/ting_yun/agent.rb', line 104

def with_database_metric_name(model, method = nil, product = nil, &block) #THREAD_LOCAL_ACCESS
  if txn = TingYun::Agent::TransactionState.tl_get.current_transaction
    txn.with_database_metric_name(model, method, product, &block)
  else
    yield
  end
end