New Relic Deployments lets you correlate your application’s performance with code changes, but its real magic is in how it doesn’t try to tell you what changed, only when.
Let’s see this in action. Imagine you’ve deployed a new version of your service, my-awesome-app, to a Kubernetes cluster. Before deploying, your New Relic dashboard shows a steady stream of transactions, but maybe a few slow ones. After the deployment, you want to see if the new code introduced performance regressions or improvements.
Here’s how you’d mark that deployment using the newrelic-infra agent:
# newrelic-infra.yml
com.newrelic.infra.deployments:
enabled: true
api_key: YOUR_API_KEY
app_name: my-awesome-app
deployment_log: /var/log/newrelic/deployments.log # Or wherever your agent can write
And then, you’d trigger a deployment event. This is typically done via an API call or by a CI/CD pipeline that writes a specific log entry. For example, using curl:
curl -X POST 'https://infra-api.newrelic.com/infra/v2/deployments' \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"applicationId": "YOUR_NEW_RELIC_APPLICATION_ID",
"deployment": {
"revision": "v1.2.3",
"timestamp": "2023-10-27T10:00:00Z",
"description": "Added caching layer to user profile endpoint",
"changelogUrl": "https://github.com/myorg/my-awesome-app/releases/tag/v1.2.3"
}
}'
The applicationId is crucial here. You can find this in your New Relic application’s URL when you’re viewing its overview page (it’s the long string of numbers after /applications/).
Once that’s done, head over to your New Relic UI. Navigate to your my-awesome-app’s overview page. You’ll now see a vertical marker on the time-series graphs corresponding to 2023-10-27T10:00:00Z. This marker isn’t just a dot; it’s a pointer. Hovering over it reveals the revision (v1.2.3), description, and changelogUrl. You can now visually inspect the performance metrics before and after this marker. Did error rates spike? Did response times increase or decrease? Did throughput change? The marker provides the temporal anchor to answer these questions.
The core problem New Relic Deployments solves is the "correlation vs. causation" dilemma when it comes to performance issues. You deploy new code, and suddenly things go sideways. Was it the code? Was it a random infrastructure blip? Deployments provide a clear signal: "At this exact moment, this specific code change was introduced." This allows you to isolate performance trends directly attributable to your releases, rather than trying to sift through noisy, unrelated events.
Internally, the newrelic-infra agent is configured to watch a specific log file (or receive API calls). When it detects the predefined deployment log format (or receives the API payload), it extracts the relevant metadata (revision, timestamp, description, etc.) and sends it to the New Relic platform as a "deployment event." The New Relic platform then associates this event with the specified applicationId and plots a marker on the corresponding time-series graphs for that application. You can also configure deployments via the New Relic CLI or directly through your CI/CD pipeline using the New Relic API.
The description field is more than just a free-text field for notes; it’s a critical piece of context. When troubleshooting, seeing "Minor UI tweak" versus "Replaced monolithic auth service with microservice" immediately sets different expectations for potential performance impacts. The changelogUrl is equally powerful, providing a direct link to the source of truth for what that revision actually entailed, often linking to pull requests or release notes.
What many users miss is that you can track deployments for multiple applications from a single newrelic-infra agent instance. By simply adding more entries to the com.newrelic.infra.deployments section, each with its own app_name and deployment_log (or by sending API calls with different applicationIds), you can centralize deployment tracking for your entire service landscape. This is particularly useful in microservice architectures where a single infrastructure agent might be running on a node that hosts several different applications.
The next step after effectively marking deployments is to automatically trigger these markers from your CI/CD pipeline, eliminating manual steps and ensuring accuracy.