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

chore: migrate from raven-js to sentry #29

Merged
merged 2 commits into from
Aug 9, 2024
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: 6 additions & 5 deletions thunorweb/templates/base-inner.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,14 @@
</div>
<div class="powered-by">Powered by <i class="fa fa-bolt"></i> Thunor</div>

{% load webpack_loader %}{% get_files 'raven' 'js' as raven_js %}
<script src="{{ raven_js.0.url }}" crossorigin="anonymous"></script>
{% load webpack_loader %}{% get_files 'sentry' 'js' as sentry_js %}
<script src="{{ sentry_js.0.url }}" crossorigin="anonymous"></script>

<script>{% load thunorweb_tags %}Raven.config('{% sentry_public_dsn %}', {
<script>{% load thunorweb_tags %}Sentry.init({
dsn: '{% sentry_public_dsn %}',
environment: '{% sentry_environment %}', release: '{% thunorweb_version %}'
}).install();
{% if user.is_authenticated %}Raven.setUserContext({email: '{{ user.email }}',
});
{% if user.is_authenticated %}Sentry.setUser({email: '{{ user.email }}',
id: '{{ user.id }}'});{% endif %}</script>

{% render_bundle 'vendor' 'js' %}
Expand Down
2 changes: 1 addition & 1 deletion thunorweb/templates/error500.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{% block tailscript %}
{% if request.sentry.id %}
<script>
Raven.showReportDialog({
Sentry.showReportDialog({
eventId: '{{ request.sentry.id }}'
});
</script>
Expand Down
11 changes: 6 additions & 5 deletions thunorweb/templates/plotly_plot.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
</div>
<div class="powered-by"><i class="fa fa-bolt"></i> Thunor</div>

{% load webpack_loader %}{% get_files 'raven' 'js' as raven_js %}
<script src="{{ raven_js.0.url }}" crossorigin="anonymous"></script>
<script>{% load raven %}{% load thunorweb_tags %}Raven.config('{% sentry_public_dsn %}', {
{% load webpack_loader %}{% get_files 'sentry' 'js' as sentry_js %}
<script src="{{ sentry_js.0.url }}" crossorigin="anonymous"></script>
<script>{% load sentry %}{% load thunorweb_tags %}Sentry.init({
dsn: '{% sentry_public_dsn %}',
environment: '{% sentry_environment %}', release: '{% thunorweb_version %}'
}).install();
{% if user.is_authenticated %}Raven.setUserContext({email: '{{ user.email }}',
});
{% if user.is_authenticated %}Sentry.setUser({email: '{{ user.email }}',
id: '{{ user.id }}'});{% endif %}</script>
{% render_bundle 'vendor' 'js' %}
{% render_bundle 'app' 'js' %}
Expand Down
2 changes: 1 addition & 1 deletion thunorweb/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"jquery-ui": "^1.12.1",
"jquery-ui-touch-punch": "^0.2.3",
"plotly.js": "^2.34.0",
"raven-js": "^3.27.0",
"@sentry/browser": "^8.25.0",
"typeahead.js": "^0.11.1",
"d3-dsv": "^1.0.8"
},
Expand Down
4 changes: 2 additions & 2 deletions thunorweb/webpack/thunorweb/js/dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ var dataset = function(showLicense) {
},
failCallback: function () {
ui.loadingModal.hide();
Raven.captureMessage("Error downloading file");
Raven.showReportDialog();
Sentry.captureMessage("Error downloading file");
Sentry.showReportDialog();
}
});
return false;
Expand Down
6 changes: 3 additions & 3 deletions thunorweb/webpack/thunorweb/js/modules/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ var ajax = (function () {
if (jqXHR.status == 409 && ajax409Handler(jqXHR)) return;
if (jqXHR.status == 502 && ajax502Handler(jqXHR)) return;
}
if (Raven != null) {
Raven.captureMessage(thrownError || jqXHR.statusText, {
if (Sentry != null) {
Sentry.captureMessage(thrownError || jqXHR.statusText, {
extra: {
type: this.type,
url: this.url,
Expand All @@ -122,7 +122,7 @@ var ajax = (function () {
message = "An unknown error occurred with the " +
"server and has been logged. Please bear" +
" with us while we look into it.<br><br>"
+ "Reference number: " + Raven.lastEventId();
+ "Reference number: " + Sentry.lastEventId();
ui.okModal({title: subject, text: message});
}
};
Expand Down
2 changes: 1 addition & 1 deletion thunorweb/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var config = {

//TODO: Compile more modules from source, removing unneeded components
plots: ["expose-loader?Plotly!./plotly"],
raven: ["expose-loader?Raven!raven-js"],
sentry: ["expose-loader?Sentry!@sentry/browser"],
vendor: ["expose-loader?jQuery!expose-loader?$!jquery", // sitewide
// "bootstrap/dist/js/bootstrap",
// "bootstrap/dist/css/bootstrap.css",
Expand Down
Loading