Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Sentry sdk #116

Merged
merged 3 commits into from
Oct 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions call_server/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,9 @@ def call_info(sid):
@cache.cached(timeout=600)
def campaign_embed_js(campaign_id):
campaign = Campaign.query.filter_by(id=campaign_id).first_or_404()
dsn_public = current_app.config.get('SENTRY_DSN_PUBLIC', '')
dsn_public_key = current_app.config.get('SENTRY_DSN_PUBLIC_KEY', '')
return Response(render_template('api/embed.js',
campaign=campaign, DSN_PUBLIC=dsn_public
campaign=campaign, DSN_PUBLIC_KEY=dsn_public_key
), content_type='application/javascript')


Expand Down
21 changes: 12 additions & 9 deletions call_server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,20 @@ def create_app(configuration=None, app_name=None, blueprints=None):
configure_app(app, configuration)

if app.config.get('SENTRY_DSN'):
from raven.contrib.flask import Sentry
sentry = Sentry()
sentry.init_app(app, dsn=app.config['SENTRY_DSN'])
sentry_report_uri = 'https://sentry.io/api/%s/csp-report/?sentry_key=%s' % (
sentry.client.remote.project, sentry.client.remote.public_key
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration

sentry = sentry_sdk.init(app.config['SENTRY_DSN'],
integrations=[FlaskIntegration()],
_experiments={"auto_enabling_integrations": True},
traces_sample_rate=0.1
)
talisman.content_security_policy_report_uri = sentry_report_uri
sentry_public_dsn = 'https://%s@sentry.io/%s' % (
sentry.client.remote.public_key, sentry.client.remote.project
sentry_dsn = sentry._client.transport.parsed_dsn
sentry_report_uri = 'https://sentry.io/api/%s/security/?sentry_key=%s' % (
sentry_dsn.project_id, sentry_dsn.public_key
)
app.config['SENTRY_DSN_PUBLIC'] = sentry_public_dsn
talisman.content_security_policy_report_uri = sentry_report_uri
app.config['SENTRY_DSN_PUBLIC_KEY'] = sentry_dsn.public_key

# init extensions once we have app context
init_extensions(app)
Expand Down
2 changes: 1 addition & 1 deletion call_server/templates/api/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ if (typeof window.jQuery === 'undefined') {

// load sentry for frontend error tracking
if (window.CallPowerOptions.errorTracking) {
getScript('https://js.sentry-cdn.com/{{DSN_PUBLIC}}.min.js',
getScript('https://js.sentry-cdn.com/{{DSN_PUBLIC_KEY}}.min.js',
function() {},
'anonymous')
}
2 changes: 1 addition & 1 deletion requirements/heroku.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-r production.txt
newrelic==4.16.0.116
raven==6.10.0
sentry-sdk==0.19.1