Skip to content
This repository has been archived by the owner on Jan 25, 2018. It is now read-only.

Integrate Raven-JS for error logging to sentry #387

Merged
merged 1 commit into from
Feb 7, 2014
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions media/js/lib/raven-proxy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
define('raven_proxy', ['settings'], function(settings) {
// Define a wrapper which will only send a message to Raven
// if it's configured
return function (message, options) {
if((typeof(Raven) != 'undefined') && (settings.zamboni_raven_url)) {
console.log('[raven] logging to Raven ' + message);

Raven.captureMessage(message, options);
}
};
});
3 changes: 3 additions & 0 deletions media/js/lib/raven.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions media/js/raven-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require(['settings', 'raven_proxy'], function(settings, ravenProxy) {
// Test for the presence of Zamboni Raven configuration
if(settings.zamboni_raven_url) {
console.log('[raven] configuring raven proxy');

// Initialize RavenJS
Raven.config(settings.zamboni_raven_url, {}).install();

// Bind our handler to the global error handler
window.onerror = function(errorMsg, url, lineNumber) {
ravenProxy(errorMsg, {
tags: {
file: url,
line: lineNumber
}
});

// Ensure default behaviour
return false;
};
}
});
9 changes: 9 additions & 0 deletions webpay/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@
'js/lib/format.js',
'js/lib/longtext.js',
'js/lib/tracking.js',
'js/lib/raven.min.js',
'js/lib/raven-proxy.js',

# These are modules used by others.
# The order is important, do not alphabetize.
'js/raven-init.js',
'js/cli.js',
'js/id.js',
'js/auth.js',
Expand Down Expand Up @@ -498,6 +501,12 @@
'ajax_timeout': 45000,
# Wait timeout (Default 60s).
'wait_timeout': 60000,
# Raven error logging
# ex: http://none@zamboni.localhost/api/v1/fireplace/report_error/12345
# Please note that the leading 'none@' is required
# The trailing integer '12345' is the sentry account id which is found in a sentry DSN
# ex: https://<user>:<pass>@app.getsentry.com/<sentry_account_id>
'zamboni_raven_url': '',
}

# New Relic is configured here.
Expand Down
1 change: 1 addition & 0 deletions webpay/settings/sites/dev/settings_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,6 @@
ALLOW_ADMIN_SIMULATIONS = True

base.JS_SETTINGS['tracking_enabled'] = True
base.JS_SETTINGS['zamboni_raven_url'] = ''

NEWRELIC_INI = '/etc/newrelic.d/marketplace-dev.allizom.org-webpay.ini'
1 change: 1 addition & 0 deletions webpay/settings/sites/identitystage/settings_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,4 @@
BROWSERID_JS_URL = 'https://%s/include.js' % BROWSERID_DOMAIN

base.JS_SETTINGS['tracking_enabled'] = True
base.JS_SETTINGS['zamboni_raven_url'] = ''
1 change: 1 addition & 0 deletions webpay/settings/sites/prod/settings_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,4 @@
ENCRYPTED_COOKIE_KEY = private.ENCRYPTED_COOKIE_KEY

base.JS_SETTINGS['tracking_enabled'] = True
base.JS_SETTINGS['zamboni_raven_url'] = ''
2 changes: 2 additions & 0 deletions webpay/settings/sites/stage/settings_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
ALLOW_ADMIN_SIMULATIONS = True

base.JS_SETTINGS['tracking_enabled'] = True
base.JS_SETTINGS['zamboni_raven_url'] = ''

NEWRELIC_INI = '/etc/newrelic.d/marketplace.allizom.org-webpay.ini'

USAGE_WARNING = True