Method: NewRelic::Agent::Transaction#with_database_metric_name

Defined in:
lib/new_relic/agent/transaction.rb

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

[View source]

873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
# File 'lib/new_relic/agent/transaction.rb', line 873

def with_database_metric_name(model, method, product = nil)
  previous = self.instrumentation_state[:datastore_override]
  model_name = case model
               when Class
                 model.name
               when String
                 model
               else
                 model.to_s
  end
  self.instrumentation_state[:datastore_override] = [method, model_name, product]
  yield
ensure
  self.instrumentation_state[:datastore_override] = previous
end