New Relic's PHP agent includes support for automatic transaction naming for the Community and Enterprise editions of Magento 1 and 2. This document describes how this works and how you can use the automated names to track issues on your Magento application.
Transactions in Magento 1 applications are named based on the module, controller, and action that handle the request. For example, a transaction for the default customer account page will be named
customer/account/index, which indicates that the
indexAction() method in
account controller in the
customer module) was responsible for the transaction.
Normal web transactions in Magento 2 applications are named similarly to Magento 1 transactions: the transaction name encodes the module, controller, and action that handled the request. For example, a request handled by the
Magento\Customer\Controller\Account\Index controller class will also be named
Magento 2 also includes built-in support for web APIs. These are web services that are made available through REST and SOAP.
As of PHP agent version 7.0, New Relic supports automatically naming transactions that use this functionality. Previous versions of the PHP agent named web API transactions as
unknown by default.
Magento 2 web APIs
SOAP transactions are named based on the service class and method that handled the request. For example, the transaction name
WSDL transactions are also named automatically:
From Magento 2.1 onwards, REST transactions are named similarly to SOAP transactions. The only difference is that REST requests are prefixed with
On Magento 2.0, the PHP agent is unable to automatically name the specific service class and method that handled the transaction. Instead, REST requests currently receive the generic name
It is possible in Magento 2 to register a plugin or interceptor for the
Magento\Framework\App\FrontControllerInterface interface to replace the default routing engine. For example, this is how the web API features operate.
If an interceptor is registered for
Magento\Framework\App\FrontControllerInterface, the name of that class will be used as the default transaction name when using New Relic's PHP agent version 7.0 or higher. You can also use
newrelic_name_transaction() for manual naming if needed.
If automatic transaction naming is not useful, you can override the PHP agent's automatic transaction naming by using the
newrelic_name_transaction() API function.