Skip to content

Commit

Permalink
Set the sentry release to the commit hash.
Browse files Browse the repository at this point in the history
  • Loading branch information
MelissaAutumn committed Jan 23, 2024
1 parent 022675a commit 6127b92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions backend/src/appointment/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Expand All @@ -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,
)


Expand Down

0 comments on commit 6127b92

Please sign in to comment.