Upgrade Sentry to v8 and remove custom Dependabot grouping

As part of the upgrade process, we need to rework the tracing instrumentation. Now, we are just wrapping all async functions in a new sentry transaction, which will automatically end once the function returns.

Further, the structure of the Sentry packages got reworked, so that we only need a single package by now. This removes the need to group dependabot updates.

Co-authored-by: Jan Graichen <jgraichen@altimos.de>
This commit is contained in:
Sebastian Serth
2024-05-20 14:00:55 +02:00
committed by Sebastian Serth
parent 86c67f3c9a
commit 94404370c4
12 changed files with 234 additions and 300 deletions

View File

@@ -202,15 +202,25 @@ var CodeOceanEditor = {
$('button i.fa-spin').removeClass('d-inline-block').addClass('d-none');
},
startSentryTransaction: function (initiator) {
const cause = initiator.data('cause') || initiator.prop('id');
this.sentryTransaction = window.SentryUtils.startIdleTransaction(
Sentry.getCurrentHub(),
{ name: cause, op: "transaction" },
0, // Idle Timeout
window.SentryUtils.TRACING_DEFAULTS.finalTimeout,
true); // onContext
Sentry.getCurrentHub().configureScope(scope => scope.setSpan(this.sentryTransaction));
newSentryTransaction: function (initiator, callback) {
// based on Sentry recommendation.
// See https://github.com/getsentry/sentry-javascript/issues/12116
return Sentry.continueTrace({ sentryTrace: '', baggage: '' }, () => {
// inside of this we have a new trace!
return Sentry.withActiveSpan(null, () => {
// inside of this there is no parent span, no matter what!
const cause = initiator.data('cause') || initiator.prop('id');
return Sentry.startSpan({name: cause, op: "transaction", forceTransaction: true}, async () => {
// Execute the desired custom code
try {
return await callback();
} catch (error) {
console.error(error);
Sentry.captureException(error, {mechanism: {handled: false}});
}
});
});
});
},
resizeAceEditors: function (own_solution = false) {