Configure New Relic for Magento 2 Undertaking to watch your retailer efficiency effectively.
Subsequently, you may monitor each request, optimize transactions, and stop slowdowns earlier than they have an effect on customers.
Furthermore, this setup supplies clear insights into your Magento retailer with out mixing knowledge from different purposes.
Why Use New Relic with Magento 2
New Relic analyzes sluggish queries, server metrics, and transaction traces.
As well as, it identifies efficiency bottlenecks earlier than they impression prospects.
Undertaking-specific configuration ensures solely your Magento retailer is monitored.
In consequence, you get correct and actionable efficiency knowledge.
Step 1: Putting in the New Relic PHP Agent
To start, set up the New Relic PHP agent in your server.
First, choose the set up technique that matches your working system.
Set up on Ubuntu/Debian
echo "deb http://apt.newrelic.com/debian/ newrelic non-free" | sudo tee /and so forth/apt/sources.listing.d/newrelic.listing wget -O- https://obtain.newrelic.com/548C16BF.gpg | sudo apt-key add - sudo apt-get replace sudo apt-get set up newrelic-php5 sudo newrelic-install set up
Set up on CentOS/RHEL
sudo rpm -Uvh https://obtain.newrelic.com/pub/newrelic/el5/i386/newrelic-repo-5-3.noarch.rpm sudo yum set up newrelic-php5 sudo newrelic-install set up
Throughout set up, the installer prompts you to enter your New Relic license key.
Consequently, the agent prompts and begins monitoring your utility.
Step 2: Verifying the Set up
php -i | grep "newrelic"
You need to see one thing like this:
$ php -i | grep "newrelic" /and so forth/php/8.2/cli/conf.d/20-newrelic.ini, newrelic newrelic.daemon.handle => @newrelic newrelic.daemon.app_connect_timeout => no worth newrelic.daemon.app_timeout => no worth newrelic.daemon.auditlog => no worth newrelic.daemon.collector_host => no worth newrelic.daemon.dont_launch => no worth newrelic.daemon.location => /usr/bin/newrelic-daemon newrelic.daemon.logfile => /var/log/newrelic/newrelic-daemon.log newrelic.daemon.loglevel => no worth newrelic.appname => PHP Utility => PHP Utility newrelic.daemon.pidfile => no worth
Subsequent, restart PHP-FPM or Apache to use the adjustments:
sudo service php7.4-fpm restart sudo service nginx restart # OR for Apache sudo service apache2 restart
At this stage, You may even see a generic app title eg: “PHP Utility” in APM.

Nevertheless, this may be custom-made to your Magento challenge.
Step 3: Configuring New Relic for Your Magento Undertaking
Edit pub/index.php
to configure New Relic.
This manner, New Relic teams all requests beneath your challenge title.
Instance code:
// Configure New Relic for this Magento utility if (extension_loaded('newrelic')) { newrelic_set_appname('CustomProject-Magento'); }
In consequence, New Relic tracks solely your Magento challenge.
Subsequently, knowledge from different PHP purposes doesn’t combine in.

Advantages of Undertaking-Degree Configuration
Setting the applying title scopes transactions to your retailer.
Moreover, it improves efficiency evaluation and troubleshooting.
Furthermore, combining this setup with instruments like Redis for Magento 2 session administration additional optimizes web site velocity.
Monitoring and Insights
As soon as configured, log in to New Relic to view APM knowledge.
You will note transactions, response occasions, database queries, and sluggish traces particular to your Magento challenge.
Undertaking-level monitoring lets you make knowledgeable choices to enhance web site velocity and reliability.
Conclusion
Putting in and configuring New Relic for Magento 2 permits detailed application-level monitoring.
Moreover, by setting the applying title in index.php
, your retailer is tracked independently from different server purposes.
This strategy retains monitoring easy, clear, and efficient.
Pairing New Relic with caching options like Redis enhances Magento’s scalability and efficiency.