From 380235912ed1af1593aa136a5fb28cb60aec7be2 Mon Sep 17 00:00:00 2001 From: Alex Steel <130377221+asteel-gsa@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:27:45 -0400 Subject: [PATCH 1/2] Update profile to use 4 different services --- backend/.profile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/.profile b/backend/.profile index f3d33025ec..f6f7e78d56 100644 --- a/backend/.profile +++ b/backend/.profile @@ -19,8 +19,8 @@ export no_proxy="${S3_ENDPOINT_FOR_NO_PROXY},${S3_FIPS_ENDPOINT_FOR_NO_PROXY},${ export NEW_RELIC_LICENSE_KEY="$(echo "$VCAP_SERVICES" | jq --raw-output --arg service_name "newrelic-creds" ".[][] | select(.name == \$service_name) | .credentials.NEW_RELIC_LICENSE_KEY")" # Set the application name for New Relic telemetry. -#export NEW_RELIC_APP_NAME="$(echo "$VCAP_APPLICATION" | jq -r .application_name)" -export NEW_RELIC_APP_NAME="$(echo "$VCAP_APPLICATION" | jq -r .application_name)-app" +# This will give 4 services (gsa-fac-dev, gsa-fac-staging, gsa-fac-production, gsa-fac-preview) +export NEW_RELIC_APP_NAME="$(echo "$VCAP_APPLICATION" | jq -r .application_name)-$(echo "$VCAP_APPLICATION" | jq -r .space_name)" # Set the environment name for New Relic telemetry. export NEW_RELIC_ENVIRONMENT="$(echo "$VCAP_APPLICATION" | jq -r .space_name)" From 77788d00b12566f62bfef57f3fe261b62a74bed8 Mon Sep 17 00:00:00 2001 From: Alex Steel <130377221+asteel-gsa@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:51:44 -0400 Subject: [PATCH 2/2] New Relic Deployment Notifications --- .github/workflows/new-relic-deployment.yml | 29 ++++++++++++++++++++++ backend/.profile | 6 +++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/new-relic-deployment.yml diff --git a/.github/workflows/new-relic-deployment.yml b/.github/workflows/new-relic-deployment.yml new file mode 100644 index 0000000000..a6a81da87b --- /dev/null +++ b/.github/workflows/new-relic-deployment.yml @@ -0,0 +1,29 @@ +name: Record Deployment And Add New Relic Monitor +on: + push: + branches: + - main + - prod + tags: + - v1.* + +jobs: + newrelic: + runs-on: ubuntu-latest + name: New Relic Record Deployment + steps: + # This step builds a var with the sha value to use later + - name: Get Git Short Commit + id: git-short + run: | + echo "short_sha=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_OUTPUT + + # This step creates a new Change Tracking Marker + - name: Add 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: "${{ steps.git-short.outputs.short_sha }}" + user: "${{ github.actor }}" + diff --git a/backend/.profile b/backend/.profile index f6f7e78d56..fe09534e13 100644 --- a/backend/.profile +++ b/backend/.profile @@ -19,8 +19,10 @@ export no_proxy="${S3_ENDPOINT_FOR_NO_PROXY},${S3_FIPS_ENDPOINT_FOR_NO_PROXY},${ export NEW_RELIC_LICENSE_KEY="$(echo "$VCAP_SERVICES" | jq --raw-output --arg service_name "newrelic-creds" ".[][] | select(.name == \$service_name) | .credentials.NEW_RELIC_LICENSE_KEY")" # Set the application name for New Relic telemetry. -# This will give 4 services (gsa-fac-dev, gsa-fac-staging, gsa-fac-production, gsa-fac-preview) -export NEW_RELIC_APP_NAME="$(echo "$VCAP_APPLICATION" | jq -r .application_name)-$(echo "$VCAP_APPLICATION" | jq -r .space_name)" +# this did not work on preview, so, since gsa-fac-app works, keeping that there +#export NEW_RELIC_APP_NAME="$(echo "$VCAP_APPLICATION" | jq -r .application_name)-$(echo "$VCAP_APPLICATION" | jq -r .space_name)" +export NEW_RELIC_APP_NAME="$(echo "$VCAP_APPLICATION" | jq -r .application_name)-app" + # Set the environment name for New Relic telemetry. export NEW_RELIC_ENVIRONMENT="$(echo "$VCAP_APPLICATION" | jq -r .space_name)"