Heroku is a Platform as a Service (PaaS) solution for hosting web applications in various agent languages, including Scala. With New Relic, you can extend Heroku with metrics from APM and .
Tip
For non-Scala installations, see Java agent and Heroku.
Compatibility and requirements
- Java 7 or higher
- Latest New Relic Java agent version
1. Enable the New Relic add-on
After you ensure that you meet the requirements, enable the New Relic agent add-on in Heroku.
Caution
You must deploy your Java app to Heroku, following the Heroku instructions at least through the Deploy the app step, before you can enable the New Relic agent add-on.
- Log in to your Heroku account.
- From the APM Add-On Page, select a subscription plan.
- Select Install APM, and then select your target app from the dropdown.
Installing the add-on automatically creates a New Relic account and configures access for Heroku servers.
2. Configure your Heroku environment for New Relic
After you complete the requirements and enable the New Relic add-on, configure your Scala Heroku environment for New Relic:
Edit your
Procfile
to point to the agent jar in your app's root folder. Replace the contents of the file, substitutingX.Y.Z
with the latest agent version:web: target/universal/stage/bin/play-getting-started -Dhttp.port=${PORT} -J-javaagent:/app/target/universal/stage/lib/com.newrelic.agent.java.newrelic-agent-X.Y.Z.jar -J-Dnewrelic.config.file=conf/newrelic.ymlOR
Identify the path to
newrelic.jar
with theJAVA_OPTS
environment variable.Edit your
build.sbt
. Call the agent, substitutingX.Y.Z
with the latest Java agent version:Download a customized
newrelic.yml
file from your APM account settings:Edit
newrelic.yml
to customize theapp_name
setting with a descriptive app name.Also in
newrelic.yml
, add your license key to thelicense_key
setting.
3. Push your changes and open the app
After you configure your Heroku environment for New Relic, push your changes and open the app to monitor it with New Relic.
Push your changes to the dyno with this Heroku toolbelt command:
bash$git add .$git commit -m 'YOUR COMMIT MESSAGE'$git push heroku masterOpen your app in your browser with this Heroku toolbelt command:
bash$heroku openGenerate some traffic to your app and wait a few minutes.
Check your app's performance in Heroku by selecting your app and then selecting the New Relic add-on.
If no data appears or if you have problems, follow the troubleshooting tips.
Troubleshooting your installation
- If you don't see the New Relic add-on after you generate traffic, go to Heroku, select Find more add ons, and add the APM add-on.
- If no data appears after waiting a few minutes, see No data appears with Heroku (Java).