cloud_foundry java_buildpack pivotal_cloud_foundry products

Monitoring Cloud Foundry Applications with New Relic

featured-cf-genericA couple of weeks ago, Ben Hale blogged about the new Cloud Foundry Java Buildpack, highlighting some great new features and our design principles – the “it just works” experience.

The new buildpack provides the opportunity for a new level of configuration and setup for popular add-on services, such as application performance and monitoring tools. The Java buildpack now includes automated configuration for the New Relic application monitoring agent. If you create a New Relic service and bind it to an application, the buildpack will set up the New Relic agent automatically when the application is staged. After the app has been staged with the New Relic configuration and traffic is flowing to the app, it generally takes several minutes for application traffic to show up in your New Relic dashboard.

nr_overview_page

If you bind a New Relic service to an existing application, you must restart the app so the buildpack can check for new services and auto-configure the environment accordingly. Without a restart, the buildpack is not aware that new auto-configurable services have been added.

On your Pivotal CF hosted web console, the “Services” section lists the active services in each space, and identifies how many (if any) apps have been bound to a specific service instance. To access the New Relic dashboard, just click on the “Manage” button below the New Relic service instance, and make sure you have at least one app bound to the New Relic service instance. The “Manage” button will open a new tab in your browser window, and automatically log you into your New Relic dashboard.

newrelic-service

How It Works

One of the extension points provided by the Java buildpack is the framework component, which allows the buildpack to customize the application deployment. The Java buildpack includes a New Relic framework component that adds New Relic-specific configuration. The New Relic framework component checks to see if a New Relic service has been bound to the application being deployed. If a New Relic service is bound, the buildpack adds the New Relic Java agent to the JVM startup command and passes the licenseKey to the agent.

The Java buildpack maintains a current copy of the latest New Relic agent, which is defined in the New Relic YAML file. To ensure fast deployment of apps to DEAs, a copy of the New Relic .jar file is cached in the local blobstore, which is hosted on Amazon’s S3, for run.pivotal.io. The cache ensures the buildpack does not have to request a new jar file from New Relic each time an app is pushed to run.pivotal.io.

Currently, only the Cloud Foundry Java buildpack supports auto-configuration of the New Relic agent and monitoring services. Depending on feedback from users, we may consider adding auto-configuration for additional runtimes in the future.

For a quick demo of the automated provisioning for New Relic (and to try it for yourself), just follow the easy steps in this video demo below.