From bcfb8e1291d56dff541dd0971bfa1bbbba3fa83e Mon Sep 17 00:00:00 2001 From: Michael Barrett Date: Thu, 9 Nov 2023 14:10:53 +0000 Subject: [PATCH] Misc Sentry tweaks (#18900) no refs - Removed redundant duplicated `save_revision` tag when capturing slow saves - Standardised Sentry tags casing (`snake_case`) - Renamed tag `adminX settings component-` to `adminx_settings_component` --- apps/admin-x-design-system/src/global/ErrorBoundary.tsx | 2 +- ghost/admin/app/controllers/lexical-editor.js | 2 -- ghost/admin/app/services/ajax.js | 6 +++--- ghost/core/core/shared/sentry.js | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/admin-x-design-system/src/global/ErrorBoundary.tsx b/apps/admin-x-design-system/src/global/ErrorBoundary.tsx index a69b1e6d07..f328a7f0c2 100644 --- a/apps/admin-x-design-system/src/global/ErrorBoundary.tsx +++ b/apps/admin-x-design-system/src/global/ErrorBoundary.tsx @@ -24,7 +24,7 @@ class ErrorBoundary extends React.Component { componentDidCatch(error: unknown, info: ErrorInfo) { Sentry.withScope((scope) => { - scope.setTag('adminX settings component-', info.componentStack); + scope.setTag('adminx_settings_component', info.componentStack); Sentry.captureException(error); }); // eslint-disable-next-line no-console diff --git a/ghost/admin/app/controllers/lexical-editor.js b/ghost/admin/app/controllers/lexical-editor.js index 1c20b6a47a..f8f4188e9c 100644 --- a/ghost/admin/app/controllers/lexical-editor.js +++ b/ghost/admin/app/controllers/lexical-editor.js @@ -695,7 +695,6 @@ export default class LexicalEditorController extends Controller { scope.setTag('post_type', post.isPage ? 'page' : 'post'); scope.setTag('save_revision', options.adapterOptions?.saveRevision); scope.setTag('email_segment', options.adapterOptions?.emailSegment); - scope.setTag('save_revision', options.adapterOptions?.saveRevision); scope.setTag('convert_to_lexical', options.adapterOptions?.convertToLexical); }); } @@ -708,7 +707,6 @@ export default class LexicalEditorController extends Controller { scope.setTag('post_type', post.isPage ? 'page' : 'post'); scope.setTag('save_revision', options.adapterOptions?.saveRevision); scope.setTag('email_segment', options.adapterOptions?.emailSegment); - scope.setTag('save_revision', options.adapterOptions?.saveRevision); scope.setTag('convert_to_lexical', options.adapterOptions?.convertToLexical); }); } diff --git a/ghost/admin/app/services/ajax.js b/ghost/admin/app/services/ajax.js index a6543239b6..402fe1f797 100644 --- a/ghost/admin/app/services/ajax.js +++ b/ghost/admin/app/services/ajax.js @@ -305,9 +305,9 @@ class ajaxService extends AjaxService { method: request.method, status }); - Sentry.setTag('ajaxStatus', status); - Sentry.setTag('ajaxUrl', request.url); - Sentry.setTag('ajaxMethod', request.method); + Sentry.setTag('ajax_status', status); + Sentry.setTag('ajax_url', request.url); + Sentry.setTag('ajax_method', request.method); if (headers['content-version']) { const contentVersion = semverCoerce(headers['content-version']); diff --git a/ghost/core/core/shared/sentry.js b/ghost/core/core/shared/sentry.js index 64ae85f19c..c2d52b10d7 100644 --- a/ghost/core/core/shared/sentry.js +++ b/ghost/core/core/shared/sentry.js @@ -39,7 +39,7 @@ if (sentryConfig && !sentryConfig.disabled) { event.tags.type = exception.errorType; event.tags.code = exception.code; event.tags.id = exception.id; - event.tags.statusCode = exception.statusCode; + event.tags.status_code = exception.statusCode; } return event; }