Skip to content

Commit

Permalink
Adjust how we handle debug errors with sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
MelissaAutumn committed Dec 3, 2024
1 parent 33cf10c commit ab5f4f2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
3 changes: 2 additions & 1 deletion backend/src/appointment/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def _common_setup():
profile_traces_max = 0.25
sample_rate = 1.0
elif environment == APP_ENV_PROD:
profile_traces_max = 0.50
profile_traces_max = 0.66
sample_rate = 1.0

def traces_sampler(sampling_context):
Expand All @@ -110,6 +110,7 @@ def traces_sampler(sampling_context):
],
profiles_sampler=traces_sampler,
traces_sampler=traces_sampler,
attach_stacktrace=True,
)


Expand Down
14 changes: 10 additions & 4 deletions backend/src/appointment/routes/caldav.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ def caldav_autodiscover_auth(
'url': lookup_url,
'branch': 'CACHE'
}
debug_exc = UnexpectedBehaviourWarning(message='Cache incorrect', info=debug_obj)
sentry_sdk.capture_exception(debug_exc)
# Raise and catch the unexpected behaviour warning so we can get proper stacktrace in sentry...
try:
raise UnexpectedBehaviourWarning(message='Cache incorrect', info=debug_obj)
except UnexpectedBehaviourWarning as ex:
sentry_sdk.capture_exception(ex)
# Ignore cached result and look it up again
lookup_url = None

Expand Down Expand Up @@ -77,8 +80,11 @@ def caldav_autodiscover_auth(
'url': lookup_url,
'branch': lookup_branch
}
debug_exc = UnexpectedBehaviourWarning(message='Invalid caldav url', info=debug_obj)
sentry_sdk.capture_exception(debug_exc)
# Raise and catch the unexpected behaviour warning so we can get proper stacktrace in sentry...
try:
raise UnexpectedBehaviourWarning(message='Invalid caldav url', info=debug_obj)
except UnexpectedBehaviourWarning as ex:
sentry_sdk.capture_exception(ex)

# Finally perform any final fixups needed
connection.url = Tools.fix_caldav_urls(connection.url)
Expand Down
7 changes: 5 additions & 2 deletions backend/src/appointment/routes/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,11 @@ def request_schedule_availability_slot(
'submitter_timezone': s_a.attendee.timezone,
'owner_timezone': subscriber.timezone,
}
debug_exc = UnexpectedBehaviourWarning(message='Invalid booking time warning!', info=debug_obj)
sentry_sdk.capture_exception(debug_exc)
# Raise and catch the unexpected behaviour warning so we can get proper stacktrace in sentry...
try:
raise UnexpectedBehaviourWarning(message='Invalid booking time warning!', info=debug_obj)
except UnexpectedBehaviourWarning as ex:
sentry_sdk.capture_exception(ex)

raise validation.SlotNotFoundException()

Expand Down

0 comments on commit ab5f4f2

Please sign in to comment.