Track changes using the CLI

The change tracking feature is a good way to monitor the effects of specific changes on your customers and systems. You do this by designating which changes you want to monitor and then viewing the results in the New Relic UI.

While you can designate which changes you want to monitor by using GraphQL or a CI/CD integration, you can also use our CLI to do the same thing. If you use the CLI to designate the changes you want to monitor, you can run either a GraphQL query or execute an NRQL query against the New Relic database to retrieve a list of those changes.

Here's a two-minute overview video, or you can jump right to the steps below.

Install the CLI

We have a new version of the CLI that enables you to send GraphQL mutations to create markers. Even if you've been using the CLI, you'll need to upgrade it to take advantage of this feature.

Follow the steps here to install or upgrade the CLI.

Make a deployment marker with the CLI

The CLI has a range of options (shown below), but the create command marks a deployment for a given New Relic entity.

This is the syntax to create a marker:

newrelic entity deployment create [flags]

Here's an example:

newrelic entity deployment create --guid INSERT_YOUR_GUID_HERE --version <1.0.0>

Primary (parent) options

-h, --help help for create
-g, --guid string the entity GUID to create change tracker
-v, --version string the tag names to add to the entity
--changelog string a URL for the changelog or list of changes if not linkable
--commit string the commit identifier, for example, a Git commit SHA
--deepLink string a link back to the system generating the deployment
--deploymentType string type of deployment, one of BASIC, BLUE_GREEN, CANARY, OTHER, ROLLING or SHADOW
--description string a description of the deployment
--groupID string string that can be used to correlate two or more events
-t --timestamp int64 the start time of the deployment, the number of milliseconds since the Unix epoch, defaults to now
-u --user string username of the deployer or bot

Options inherited from parent commands

-a, --accountId int the account ID to use. Can be overridden by setting NEW_RELIC_ACCOUNT_ID
--debug debug level logging
--format string output text format [JSON, Text, YAML] (default "JSON")
--plain output compact text
--profile string the authentication profile to use
--trace trace level logging

What's next

After you've used the CLI to designate the changes you want to track, you can analyze the effect of those changes in the New Relic UI: