--> -->

Platform.sh supports New Relic APM for profiling PHP and Java applications. These instructions do not apply to other languages.

On a Grid plan 

1. Get your license key 

Sign up at https://newrelic.com and get your license key.

2. Add your license key 

Add your New Relic license key as a project level variable:

platform variable:create --visible-build false php:newrelic.license --value '<your-new-relic-license-key>'


3. Enable the New Relic extension 

Enable the New Relic extension in your .platform.app.yaml as follows:

        - newrelic

Push the changes to your Platform.sh environment to enable New Relic as follows:

git add .platform.app.yaml
git commit -m "Enable New Relic."
git push

That’s it! You need to wait a little bit for your New Relic dashboard to be generated.


To set up New Relic in the Java project, we have two ways:

  • Using the Maven project
  • Download the code through .platform.app.yaml.


This section explains how to configure Maven to download and unzip the newrelic-java.zip file, which contains all New Relic Java agent components.

To set up the application with New Relic, you have two options:

  1. Configuring and downloading from Maven
  2. Downloading on your own

Configure your pom.xml to download newrelic-java.zip. For example:


Replace JAVA_AGENT_VERSION with the latest Java agent version 1.

Unzip newrelic-java.zip by configuring maven-dependency-plugin in your pom.xml. For example:


The next step is to configure the .platform.app.yaml file to:

  1. Set the agent in the JVM parameters
  2. Overwrite the application file with the proper license key and application name. You can also do it using the API or the management console. Therefore this configuration will work outside the code very useful when the application is on a public repository.
name: app
type: 'java:8'
disk: 1024
    build: |
        mvn clean package
        rm -rf newrelic/
        mv target/newrelic/ newrelic/        

        source: local
        source_path: server_source


        start: |
                          java -jar \
            -Xmx$(jq .info.limits.memory /run/config.json)m -XX:+ExitOnOutOfMemoryError \
            -javaagent:/app/newrelic/newrelic.jar //the other parameters here

Manual Configuration 

To use this installation it is only required that you modify .platform.app.yaml , which will download and set the New Relic Java agent for you.

name: app
type: 'java:8'
disk: 1024

        NEW_RELIC_URL: https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip

    build: |
      mvn clean package
      rm -rf newrelic
      curl -O $NEW_RELIC_URL
      unzip newrelic-java.zip      

        start: |
            java -jar \
            -Xmx$(jq .info.limits.memory /run/config.json)m \
            -XX:+ExitOnOutOfMemoryError \
            -javaagent:/app/newrelic/newrelic.jar //the left of the commands here            

On a Dedicated cluster 

Sign up at https://newrelic.com and get your license key. Then open a support ticket and let us know what your key is. Our support team will install it and let you know when it is complete.


Additionally, you can check that your application is properly connected to New Relic by looking at the /var/log/app.log file:

platform log app

2017/04/19 14:00:16.706450 (93) Info: Reporting to: https://rpm.newrelic.com/accounts/xxx/applications/xxx
2017/04/19 14:00:16.706668 (93) Info: app 'xxx-master-xxx.app' connected with run id 'xxx'