-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(reporting): Added a module for configuring reporting via Sentry
- Loading branch information
Showing
3 changed files
with
31 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import sentry_sdk | ||
from furl import furl | ||
|
||
def config(service, sentry_dsn=None, sentry_trace_rate=0.0, sentry_profile_rate=0.0): | ||
|
||
def filter_transactions(event, hint): | ||
parsed_url = furl(event["request"]["url"]) | ||
|
||
# Do not sample healthcheck requests | ||
if parsed_url.path == "/healthcheck": | ||
return None | ||
|
||
return event | ||
|
||
# Setup sentry | ||
sentry_sdk.init( | ||
dsn=sentry_dsn, | ||
# Filter transactions | ||
before_send_transaction=filter_transactions, | ||
# Set traces_sample_rate to 1.0 to capture 100% | ||
# of transactions for tracing. | ||
traces_sample_rate=sentry_trace_rate, | ||
# Set profiles_sample_rate to 1.0 to profile 100% | ||
# of sampled transactions. | ||
# We recommend adjusting this value in production. | ||
profiles_sample_rate=sentry_profile_rate, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,5 @@ requests | |
furl | ||
pyjwt<3.0,>2.0 | ||
django-bootstrap3 | ||
raven>=6.9.0 | ||
sentry-sdk[django]<3.0 | ||
pytz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters