Skip to content

Commit

Permalink
Merge pull request #4195 from magfest/sentry
Browse files Browse the repository at this point in the history
Adding sentry hooks
  • Loading branch information
bitbyt3r authored Aug 3, 2023
2 parents ec1adee + 0f55f5e commit 9e67172
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cherrypy==17.3.0
celery
celery==5.1.2
python-dateutil==2.6.0
psycopg2
psycopg2==2.9.6
py3k-bcrypt==0.3
stripe==2.42.0
authorizenet==1.1.4
Expand Down Expand Up @@ -30,4 +30,5 @@ WTForms==3.0.0
pyyaml==6.0
pycountry==22.3.5
python3-saml==1.15.0
librabbitmq
librabbitmq==2.0.0
sentry-sdk==1.9.0
1 change: 1 addition & 0 deletions uber/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,7 @@ def _unrepr(d):

_unrepr(_config['appconf'])
c.APPCONF = _config['appconf'].dict()
c.SENTRY = _config['sentry'].dict()

c.BADGE_PRICES = _config['badge_prices']
for _opt, _val in chain(_config.items(), c.BADGE_PRICES.items()):
Expand Down
6 changes: 6 additions & 0 deletions uber/configspec.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1830,6 +1830,12 @@ __many__ = string(default="")
[celery]
# Celery configuration, except for broker_url which can be found in [secret]

[sentry]
enabled = boolean(default=False)
dsn = string
environment = string(default="production")
sample_rate = integer(default=100)
release = string

[appconf]
# This is all CherryPy configuration.
Expand Down
12 changes: 12 additions & 0 deletions uber/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@

mimetypes.init()

if c.SENTRY['enabled']:
import sentry_sdk
sentry_sdk.init(
dsn=c.SENTRY['dsn'],
environment=c.SENTRY['environment'],
release=c.SENTRY['release'],

# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production.
traces_sample_rate=c.SENTRY['sample_rate'] / 100
)

def _add_email():
[body] = cherrypy.response.body
Expand Down

0 comments on commit 9e67172

Please sign in to comment.