Updated AJAX error context sent to Sentry from admin (#18831)

no issues

- Added isAjaxError tag to all errors sent from admin with a true/false
value
- Removed all Ajax context and tags if the error is not an Ajax error
- Updated names of Ajax tags to use camelcase instead of dot notation
This commit is contained in:
Chris Raible 2023-11-01 14:48:23 -07:00 committed by GitHub
parent 75672a902b
commit 4ae8fc91fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -193,11 +193,18 @@ export default Route.extend(ShortcutsRoute, {
}
// ajax errors — improve logging and add context for debugging
if (exception && exception.payload && isEmberArray(exception.payload.errors) && exception.payload.errors.length > 0) {
if (isAjaxError(exception)) {
const error = exception.payload.errors[0];
event.exception.values[0].type = `${error.type}: ${error.context}`;
event.exception.values[0].value = error.message;
event.exception.values[0].context = error.context;
event.tags.isAjaxError = true;
} else {
event.tags.isAjaxError = false;
delete event.contexts.ajax;
delete event.tags.ajaxStatus;
delete event.tags.ajaxMethod;
delete event.tags.ajaxUrl;
}
return event;

View File

@ -305,9 +305,9 @@ class ajaxService extends AjaxService {
method: request.method,
status
});
Sentry.setTag('ajax.status', status);
Sentry.setTag('ajax.url', request.url);
Sentry.setTag('ajax.method', request.method);
Sentry.setTag('ajaxStatus', status);
Sentry.setTag('ajaxUrl', request.url);
Sentry.setTag('ajaxMethod', request.method);
if (headers['content-version']) {
const contentVersion = semverCoerce(headers['content-version']);