2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

Added RewriteFrames integration to Admin Sentry (#18969)

no issue

- Currently our stack traces in Production include the admin build
version in the paths, e.g. `/admin/1633/assets` instead of
`admin/assets`
- This confuses the error grouping logic in Sentry, resulting in many
duplicate issues being created every time we release a new version of
admin
- Ultimately, this makes it really difficult to determine if a 'New'
issue in Sentry is actually new, or if it's just the first time we've
seen it in this release.
- This commit adds the `RewriteFrames` integration to the Admin Sentry
client, which will strip the build version from the paths in the stack
traces, and allow Sentry to group issues correctly.
- With this, hopefully we will have far fewer 'New' issues created, so
we can again start alerting on the 'New' condition in Sentry.
This commit is contained in:
Chris Raible 2023-11-14 18:16:29 -08:00 committed by GitHub
parent d8aba91f51
commit 5f7c7a82dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 11 deletions

View file

@ -7,6 +7,7 @@ import ShortcutsRoute from 'ghost-admin/mixins/shortcuts-route';
import ctrlOrCmd from 'ghost-admin/utils/ctrl-or-cmd';
import windowProxy from 'ghost-admin/utils/window-proxy';
import {Debug} from '@sentry/integrations';
import {RewriteFrames} from '@sentry/integrations';
import {importSettings} from '../components/admin-x/settings';
import {inject} from 'ghost-admin/decorators/inject';
import {
@ -210,10 +211,26 @@ export default Route.extend(ShortcutsRoute, {
},
// TransitionAborted errors surface from normal application behaviour
// - https://github.com/emberjs/ember.js/issues/12505
ignoreErrors: [/^TransitionAborted$/]
ignoreErrors: [/^TransitionAborted$/],
integrations: [
// Stack frames in production are rewritten to remove the version identifier
// from the path. This makes grouping by stack trace not work.
// Before: /admin/1633/assets/path/to/file.js
// After: /admin/assets/path/to/file.js
new RewriteFrames({
iteratee: (frame) => {
if (frame.filename) {
// Check if the frame.filename matches /admin/1633/assets
// and rewrite it to /admin/assets
frame.filename = frame.filename.replace(/\/admin\/\d+\/assets/, '/admin/assets');
}
return frame;
}
})
]
};
if (this.config.sentry_env === 'development') {
sentryConfig.integrations = [new Debug()];
sentryConfig.integrations.push(new Debug());
}
Sentry.init(sentryConfig);
}

View file

@ -40,6 +40,7 @@
"@glimmer/component": "1.1.2",
"@html-next/vertical-collection": "3.0.0",
"@sentry/ember": "7.78.0",
"@sentry/integrations": "7.80.0",
"@tryghost/color-utils": "0.2.0",
"@tryghost/ember-promise-modals": "2.0.1",
"@tryghost/helpers": "1.1.88",
@ -168,7 +169,6 @@
"*.js": "eslint"
},
"dependencies": {
"@sentry/integrations": "^7.75.1",
"jose": "4.15.4",
"path-browserify": "1.0.1",
"webpack": "5.89.0"
@ -199,4 +199,4 @@
}
}
}
}
}

View file

@ -4884,6 +4884,14 @@
"@sentry/types" "7.78.0"
"@sentry/utils" "7.78.0"
"@sentry/core@7.80.0":
version "7.80.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.80.0.tgz#7b8a460c19160b81ade20080333189f1a80c1410"
integrity sha512-nJiiymdTSEyI035/rdD3VOq6FlOZ2wWLR5bit9LK8a3rzHU3UXkwScvEo6zYgs0Xp1sC0yu1S9+0BEiYkmi29A==
dependencies:
"@sentry/types" "7.80.0"
"@sentry/utils" "7.80.0"
"@sentry/ember@7.78.0":
version "7.78.0"
resolved "https://registry.yarnpkg.com/@sentry/ember/-/ember-7.78.0.tgz#4c17d9e719611f681abce3f091aa6fa45508d0e1"
@ -4898,14 +4906,14 @@
ember-cli-htmlbars "^6.1.1"
ember-cli-typescript "^5.1.1"
"@sentry/integrations@^7.75.1":
version "7.78.0"
resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-7.78.0.tgz#9dc149c0ff92535c412a6f6eeaa6f8613fa0c83a"
integrity sha512-h5D2CqM3KPD5hcDFBSsaVGUz95QDuEaKU9juhb96os5zpg5c3VfSWE+u9CuABXu+cXS5+TVfffVrZ+A+YFo+Rg==
"@sentry/integrations@7.80.0":
version "7.80.0"
resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-7.80.0.tgz#d81dc3b357d4efd4368471b39496494ab221a64a"
integrity sha512-9xI+jtqSBrAG/Y2f4OyeJhl6WZR3i0qCXRwqCZoCFCDgN4ZQORc4VBwaC3nW2s9jgfb13FC2FQToGOVrRnsetg==
dependencies:
"@sentry/core" "7.78.0"
"@sentry/types" "7.78.0"
"@sentry/utils" "7.78.0"
"@sentry/core" "7.80.0"
"@sentry/types" "7.80.0"
"@sentry/utils" "7.80.0"
localforage "^1.8.1"
"@sentry/node@7.78.0", "@sentry/node@^7.73.0":
@ -4951,6 +4959,11 @@
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.78.0.tgz#1ed40b43dbf7b92d4e7117d66be312a927cb48e4"
integrity sha512-XNyu6EFTrXmKlVgKHOxGdBJ6Aw7BnMBWtptr5TPOQJ4kh+rP+4DB3I6nafcSSUbIsO+hBVgBpj0J8R3Ps86CMQ==
"@sentry/types@7.80.0":
version "7.80.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.80.0.tgz#f6896de2d231a7f8d814cf1c981c474240e96d8a"
integrity sha512-4bpMO+2jWiWLDa8zbTASWWNLWe6yhjfPsa7/6VH5y9x1NGtL8oRbqUsTgsvjF3nmeHEMkHQsC8NHPaQ/ibFmZQ==
"@sentry/utils@7.78.0":
version "7.78.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.78.0.tgz#a3dd459f2347e20af81bfe92b6f75bae95918fb8"
@ -4958,6 +4971,13 @@
dependencies:
"@sentry/types" "7.78.0"
"@sentry/utils@7.80.0":
version "7.80.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.80.0.tgz#5bd682fa9a382eea952d4fa3628f0f33e4240ff3"
integrity sha512-XbBCEl6uLvE50ftKwrEo6XWdDaZXHXu+kkHXTPWQEcnbvfZKLuG9V0Hxtxxq3xQgyWmuF05OH1GcqYqiO+v5Yg==
dependencies:
"@sentry/types" "7.80.0"
"@sidvind/better-ajv-errors@^2.0.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@sidvind/better-ajv-errors/-/better-ajv-errors-2.1.0.tgz#54f4216d2200d60e90ec25c6a27c1ea3afdc6cdf"