Method: NewRelic::Agent#set_transaction_name

Defined in:
lib/new_relic/agent.rb

#set_transaction_name(name, options = {}) ⇒ Object

Set the name of the current running transaction. The agent will apply a reasonable default based on framework routing, but in cases where this is insufficient, this can be used to manually control the name of the transaction.

The category of transaction can be specified via the :category option. The following are the only valid categories:

  • :category => :controller indicates that this is a controller action and will appear with all the other actions.

  • :category => :task indicates that this is a background task and will show up in New Relic with other background tasks instead of in the controllers list

  • :category => :middleware if you are instrumenting a rack middleware call. The :name is optional, useful if you have more than one potential transaction in the #call.

  • :category => :uri indicates that this is a web transaction whose name is a normalized URI, where ‘normalized’ means the URI does not have any elements with data in them such as in many REST URIs.

The default category is the same as the running transaction.



750
751
752
753
# File 'lib/new_relic/agent.rb', line 750

def set_transaction_name(name, options = {})
  record_api_supportability_metric(:set_transaction_name)
  Transaction.set_overriding_transaction_name(name, options[:category])
end