You can use the New Relic change tracking feature in conjunction with GitHub Actions to monitor the effect of changes on your customers and systems. With GitHub Actions, you can designate which changes to monitor, and then look at the results in the New Relic UI. This allows you to track changes you make in your environment during your release pipeline.
Inputs
Here are the input elements:
Key | Required | Default | Description |
---|---|---|---|
| yes | n/a | The entity GUID to apply the change marker |
| yes | n/a | Your New Relic personal API key |
| no | n/a | A summary of what went into this change that is visible in the Change tracking page |
| no | n/a | The Commit SHA for this change that is visible in the Change tracking page |
| no | n/a | A high-level description of this change, visible in the Overview page and on the Change tracking page when you select an individual change |
| no | n/a | A deep link to the source which triggered the change |
| no |
| The type of deployment. Besides the default of |
| no | n/a | A group ID for the change to link to other changes |
| no |
| The region of your New Relic account |
| yes | n/a | Metadata to apply to the change marker, such as the latest release tag |
| yes |
| A username to associate with the change that is visible in the Overview and Deployments pages |
Example usage
GitHub secrets
Make sure the following Github secrets are set:
NEW_RELIC_API_KEY
- Personal API keyNEW_RELIC_DEPLOYMENT_ENTITY_GUID
- New Relic Entity GUID to create the marker on
Check the New Relic Application Deployment Marker page and click the Use latest version button to make sure you use the latest version available.
There are a number of default GitHub environment variables that are used in these examples as well.
Minimum required fields
name: Change Tracking Marker on: release: types: [published]
jobs: newrelic: runs-on: ubuntu-latest name: New Relic steps: # This step builds a var with the release tag value to use later - name: Set Release Version from Tag run: echo "RELEASE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV # This step creates a new Change Tracking Marker - name: New Relic Application Deployment Marker uses: newrelic/deployment-marker-action@v2.3.0 with: apiKey: ${{ secrets.NEW_RELIC_API_KEY }} guid: ${{ secrets.NEW_RELIC_DEPLOYMENT_ENTITY_GUID }} version: "${{ env.RELEASE_VERSION }}" user: "${{ github.actor }}"
All input fields
In addition to
NEW_RELIC_API_KEY
, this example shows how to target multiple items by storing multiple secrets like "NEW_RELIC_DEPLOYMENT_ENTITY_GUID_<ID>
", where<ID>
is the unique identifier for the target item.
NEW_RELIC_DEPLOYMENT_ENTITY_GUID_App123NEW_RELIC_DEPLOYMENT_ENTITY_GUID_App456NEW_RELIC_DEPLOYMENT_ENTITY_GUID_App789
name: Change Tracking Markeron: workflow_dispatch: release: types: [published]
jobs: newrelic: runs-on: ubuntu-latest name: New Relic steps: # This step builds a var with the release tag value to use later - name: Set Release Version from Tag run: echo "RELEASE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV # This step creates a new Change Tracking Marker for App123 - name: App123 Marker uses: newrelic/deployment-marker-action@v2.3.0 with: apiKey: ${{ secrets.NEW_RELIC_API_KEY }} guid: ${{ secrets.NEW_RELIC_DEPLOYMENT_ENTITY_GUID_App123 }} version: "${{ env.RELEASE_VERSION }}" changelog: "https://github.com/${{ github.repository }}/blob/master/CHANGELOG.md" commit: "${{ github.sha }}" description: "Automated Release via Github Actions" deploymentType: "ROLLING" groupId: "Workshop App Release: ${{ github.ref_name }}" user: "${{ github.actor }}" # This step creates a new Change Tracking Marker for App456 - name: App456 Marker uses: newrelic/deployment-marker-action@v2.3.0 with: apiKey: ${{ secrets.NEW_RELIC_API_KEY }} guid: ${{ secrets.NEW_RELIC_DEPLOYMENT_ENTITY_GUID_App456 }} version: "${{ env.RELEASE_VERSION }}" changelog: "https://github.com/${{ github.repository }}/blob/master/CHANGELOG.md" commit: "${{ github.sha }}" description: "Automated Release via Github Actions" deploymentType: "ROLLING" groupId: "Workshop App Release: ${{ github.ref_name }}" user: "${{ github.actor }}" # This step creates a new Change Tracking Marker for App789 - name: App789 Marker uses: newrelic/deployment-marker-action@v2.3.0 with: apiKey: ${{ secrets.NEW_RELIC_API_KEY }} guid: ${{ secrets.NEW_RELIC_DEPLOYMENT_ENTITY_GUID_App789 }} version: "${{ env.RELEASE_VERSION }}" changelog: "https://github.com/${{ github.repository }}/blob/master/CHANGELOG.md" commit: "${{ github.sha }}" description: "Automated Release via Github Actions" deploymentType: "ROLLING" groupId: "Workshop App Release: ${{ github.ref_name }}" user: "${{ github.actor }}"
What's next
After you've designated the changes you want to track, you can analyze the effect of those changes in the New Relic UI. For details, see How to view and analyze your changes in New Relic.