diff --git a/requirements.txt b/requirements.txt index d3b1559d9..ed34caa42 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 @@ -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 \ No newline at end of file diff --git a/uber/config.py b/uber/config.py index 374554ce3..2acf82550 100644 --- a/uber/config.py +++ b/uber/config.py @@ -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()): diff --git a/uber/configspec.ini b/uber/configspec.ini index 53aa575b6..e30ac4228 100644 --- a/uber/configspec.ini +++ b/uber/configspec.ini @@ -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. diff --git a/uber/server.py b/uber/server.py index a0fefd43a..6ff01bf34 100644 --- a/uber/server.py +++ b/uber/server.py @@ -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