Acquia dropped support for New Relic Lite and Standard in June 2017. Since then, you have only been able to get APM features on Acquia by paying for a New Relic Professional subscription. They also removed the ability to configure the New Relic API key for a given environment.
But we can undo this damage! By calling newrelic_set_appname()
in your index.php
file you can change the account where APM metrics are sent.
Get the API key for your New Relic account by clicking the + Add more button from the Applications list.
In the Acquia dashboard, add a new environment variable for each of your environments called NEWRELIC_API_KEY
- follow this guide on how to do that.
Add the following lines to the top of your application’s index.php
file.
// Sends metrics to a configurable New Relic account.
if (extension_loaded('newrelic') && getenv("NEWRELIC_API_KEY")) {
$app_name = sprintf("%s - %s", getenv("AH_SITE_GROUP"), getenv("AH_SITE_ENVIRONMENT"));
newrelic_set_appname($app_name, getenv("NEWRELIC_API_KEY"), TRUE);
}
You can also use this patch if your build process overwrites index.php.
Once this code is deployed to each environment, the application will appear in your New Relic account and you will be able to view your APM metrics. Happy days!