From 6127b928e83c80f9927dd6db8ee5a5da0e2946d1 Mon Sep 17 00:00:00 2001 From: Melissa Autumn Date: Tue, 23 Jan 2024 13:49:08 -0800 Subject: [PATCH] Set the sentry release to the commit hash. --- .github/workflows/aws.yml | 1 + backend/src/appointment/main.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/aws.yml b/.github/workflows/aws.yml index 615821045..98970c77f 100644 --- a/.github/workflows/aws.yml +++ b/.github/workflows/aws.yml @@ -81,6 +81,7 @@ jobs: task-definition: ${{ env.ECS_TASK_DEFINITION }} container-name: ${{ env.CONTAINER_BACKEND }} image: ${{ steps.build-backend.outputs.image_backend }} + environment-variables: "RELEASE_VERSION=${{ vars.GITHUB_SHA }}" - name: Fill in the new frontend image ID in the Amazon ECS task definition id: task-def-frontend diff --git a/backend/src/appointment/main.py b/backend/src/appointment/main.py index 43f8614e1..17af4e193 100644 --- a/backend/src/appointment/main.py +++ b/backend/src/appointment/main.py @@ -56,6 +56,12 @@ def _common_setup(): logging.debug("Logger started!") if os.getenv("SENTRY_DSN") != "" and os.getenv("SENTRY_DSN") is not None: + + release_string = None + release_version = os.getenv('RELEASE_VERSION') + if release_version: + release_string = f"appointment-backend@{release_version}" + sentry_sdk.init( dsn=os.getenv("SENTRY_DSN"), # Set traces_sample_rate to 1.0 to capture 100% @@ -65,6 +71,7 @@ def _common_setup(): # Only profile staging for now profiles_sample_rate=1.0 if os.getenv("APP_ENV", "stage") else 0.0, environment=os.getenv("APP_ENV", "dev"), + release=release_string, )