score:4

Accepted answer

I found the solution is to add the New Relic binaries from the Maven repository, then to point the Procfile to the right place. The detailed solution is for Scala, but should work in Java too:

  1. Download the newrelic.yml file and add it to your git repository in the root of the Play Framework app.

  2. Add the New Relic dependency to Build.scala:

    val appDependencies = Seq(
      "com.newrelic.agent.java" % "newrelic-agent" % "3.7.0",
      //Other dependencies here
    )
    
    val main = play.Project(appName, appVersion, appDependencies)
    
  3. Add the following to the web: entry of your Play Framework app's Procfile (all in one line):

    -J-javaagent:target/universal/stage/lib/com.newrelic.agent.java.newrelic-agent-3.7.0.jar
    -J-Dnewrelic.config.file=newrelic.yml
    
  4. Commit all your changes and push to your Heroku app's git repository.

  5. Wait for Heroku to build and deploy the app, then a few minutes for New Relic to start displaying data.

  6. Drool at New Relic's InfoPorn! :-D

I found the path where the New Relic agent was being downloaded from the Maven repository by connecting to my Heroku app's terminal (heroku run bash in the CLI) and searching around.


Related Query

More Query from same tag