Skip to content

Commit

Permalink
Add guarding clauses to the sentry filter
Browse files Browse the repository at this point in the history
  • Loading branch information
dansahagian committed Jul 30, 2024
1 parent 7051ed9 commit f74fcd5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions fbsurvivor/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,20 @@ def before_send(event, hint):


def filter_transactions(event, hint):
url_string = event["request"]["url"]
parsed_url = urlparse(url_string)
request = event.get("request")
if not request:
return None

url = request.get("url")
if not url:
return None

parsed_url = urlparse(url)
base_url = parsed_url.path[1:].split("/")[0]

if base_url in BASE_URLS:
return event
else:
return None
return None


sentry_sdk.init(
Expand Down

0 comments on commit f74fcd5

Please sign in to comment.