Enable new relic on your app, either using the web interface, or in your terminal:
heroku addons:add newrelic:standard
The documentation is here.
Download and unzip the new relic zipfile into play 2 app lib folder.
Add the lib folder and it’s content to your git repository.
$ git add lib
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: lib/newrelic/newrelic-api.jar
# new file: lib/newrelic/newrelic.jar
# new file: lib/newrelic/newrelic.yml
To enable the new relic java agent change the Procfile in the root of your play 2 application(more info here and here.
Add javaagent configuration to your heroku config:
heroku config:add \
PLAY_OPTS='-javaagent:lib/newrelic/newrelic.jar'
Contents of Procfile:
web: target/start -Dhttp.port=$PORT \
-DapplyEvolutions.default=true \
-Ddb.default.driver=org.postgresql.Driver \
-Ddb.default.url=$DATABASE_URL $PLAY_OPTS
And push the changes to Heroku
git commit -am "Configuration for new relic agent"
git push heroku master