mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
refactor(core): Update backend sentry setup to reduce noise (no-changelog) (#8026)
## Summary This PR updates our backend sentry setup to remove integrations that don't provide us any value. This also reduces the amount of PII that gets sent to Sentry. [Sample event](https://n8nio.sentry.io/issues/4725315362/) ## Related tickets [ENG-95](https://linear.app/n8n/issue/ENG-95) ## Review / Merge checklist - [x] PR title and summary are descriptive.
This commit is contained in:
committed by
GitHub
parent
614f488386
commit
a651089a10
@@ -106,8 +106,8 @@
|
||||
"@oclif/core": "1.16.6",
|
||||
"@oclif/errors": "1.3.6",
|
||||
"@rudderstack/rudder-sdk-node": "1.0.6",
|
||||
"@sentry/integrations": "7.86.0",
|
||||
"@sentry/node": "7.86.0",
|
||||
"@sentry/integrations": "7.87.0",
|
||||
"@sentry/node": "7.87.0",
|
||||
"axios": "0.21.4",
|
||||
"basic-auth": "2.0.1",
|
||||
"bcryptjs": "2.4.3",
|
||||
|
||||
@@ -12,7 +12,7 @@ export const initErrorHandling = async () => {
|
||||
});
|
||||
|
||||
const dsn = config.getEnv('diagnostics.config.sentry.dsn');
|
||||
if (!config.getEnv('diagnostics.enabled') || !dsn) {
|
||||
if (!dsn) {
|
||||
initialized = true;
|
||||
return;
|
||||
}
|
||||
@@ -20,25 +20,51 @@ export const initErrorHandling = async () => {
|
||||
// Collect longer stacktraces
|
||||
Error.stackTraceLimit = 50;
|
||||
|
||||
const { N8N_VERSION: release, ENVIRONMENT: environment } = process.env;
|
||||
const {
|
||||
N8N_VERSION: release,
|
||||
ENVIRONMENT: environment,
|
||||
DEPLOYMENT_NAME: serverName,
|
||||
} = process.env;
|
||||
|
||||
const { init, captureException, addGlobalEventProcessor } = await import('@sentry/node');
|
||||
const { init, captureException, addEventProcessor } = await import('@sentry/node');
|
||||
|
||||
const { RewriteFrames } = await import('@sentry/integrations');
|
||||
const { Integrations } = await import('@sentry/node');
|
||||
|
||||
const enabledIntegrations = [
|
||||
'InboundFilters',
|
||||
'FunctionToString',
|
||||
'LinkedErrors',
|
||||
'OnUnhandledRejection',
|
||||
'ContextLines',
|
||||
];
|
||||
init({
|
||||
dsn,
|
||||
release,
|
||||
environment,
|
||||
integrations: (integrations) => {
|
||||
integrations = integrations.filter(({ name }) => name !== 'OnUncaughtException');
|
||||
integrations.push(new RewriteFrames({ root: process.cwd() }));
|
||||
return integrations;
|
||||
},
|
||||
enableTracing: false,
|
||||
serverName,
|
||||
beforeBreadcrumb: () => null,
|
||||
integrations: (integrations) => [
|
||||
...integrations.filter(({ name }) => enabledIntegrations.includes(name)),
|
||||
new RewriteFrames({ root: process.cwd() }),
|
||||
new Integrations.RequestData({
|
||||
include: {
|
||||
cookies: false,
|
||||
data: false,
|
||||
headers: false,
|
||||
query_string: false,
|
||||
url: true,
|
||||
user: false,
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
const seenErrors = new Set<string>();
|
||||
addGlobalEventProcessor((event, { originalException }) => {
|
||||
addEventProcessor((event, { originalException }) => {
|
||||
if (!originalException) return null;
|
||||
|
||||
if (originalException instanceof ApplicationError) {
|
||||
const { level, extra, tags } = originalException;
|
||||
if (level === 'warning') return null;
|
||||
@@ -47,8 +73,7 @@ export const initErrorHandling = async () => {
|
||||
if (tags) event.tags = { ...event.tags, ...tags };
|
||||
}
|
||||
|
||||
if (!event.exception) return null;
|
||||
const eventHash = createHash('sha1').update(JSON.stringify(event.exception)).digest('base64');
|
||||
const eventHash = createHash('sha1').update(JSON.stringify(originalException)).digest('base64');
|
||||
if (seenErrors.has(eventHash)) return null;
|
||||
seenErrors.add(eventHash);
|
||||
|
||||
|
||||
60
pnpm-lock.yaml
generated
60
pnpm-lock.yaml
generated
@@ -454,11 +454,11 @@ importers:
|
||||
specifier: 1.0.6
|
||||
version: 1.0.6
|
||||
'@sentry/integrations':
|
||||
specifier: 7.86.0
|
||||
version: 7.86.0
|
||||
specifier: 7.87.0
|
||||
version: 7.87.0
|
||||
'@sentry/node':
|
||||
specifier: 7.86.0
|
||||
version: 7.86.0
|
||||
specifier: 7.87.0
|
||||
version: 7.87.0
|
||||
axios:
|
||||
specifier: 0.21.4
|
||||
version: 0.21.4
|
||||
@@ -6828,20 +6828,20 @@ packages:
|
||||
selderee: 0.6.0
|
||||
dev: false
|
||||
|
||||
/@sentry-internal/tracing@7.86.0:
|
||||
resolution: {integrity: sha512-b4dUsNWlPWRwakGwR7bhOkqiFlqQszH1hhVFwrm/8s3kqEBZ+E4CeIfCvuHBHQ1cM/fx55xpXX/BU163cy+3iQ==}
|
||||
/@sentry-internal/tracing@7.87.0:
|
||||
resolution: {integrity: sha512-HYa0+rfFmYQ/DadXoiuarTSxrcnYDCd/fm0pFuOHjICtfja8IcLegVYP2/r3CgwB+IjquCtJ5kDcqS/NTgUcpA==}
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
'@sentry/core': 7.86.0
|
||||
'@sentry/types': 7.86.0
|
||||
'@sentry/utils': 7.86.0
|
||||
'@sentry/core': 7.87.0
|
||||
'@sentry/types': 7.87.0
|
||||
'@sentry/utils': 7.87.0
|
||||
|
||||
/@sentry/bundler-plugin-core@2.5.0:
|
||||
resolution: {integrity: sha512-UNjeTSf0Irt/RsC1Xsfxa+RC92mBvjzuWQnvHJ5c+mXwUt+jLcFgGMCSVK/FCDZO+gAeKzmU1+G2UexbsNAP8w==}
|
||||
engines: {node: '>= 14'}
|
||||
dependencies:
|
||||
'@sentry/cli': 2.17.0(patch_hash=nchnoezkq6p37qaiku3vrpwraq)
|
||||
'@sentry/node': 7.86.0
|
||||
'@sentry/node': 7.87.0
|
||||
'@sentry/utils': 7.60.1
|
||||
dotenv: 16.3.1
|
||||
find-up: 5.0.0
|
||||
@@ -6869,31 +6869,31 @@ packages:
|
||||
dev: true
|
||||
patched: true
|
||||
|
||||
/@sentry/core@7.86.0:
|
||||
resolution: {integrity: sha512-SbLvqd1bRYzhDS42u7GMnmbDMfth/zRiLElQWbLK/shmuZzTcfQSwNNdF4Yj+VfjOkqPFgGmICHSHVUc9dh01g==}
|
||||
/@sentry/core@7.87.0:
|
||||
resolution: {integrity: sha512-jkoXqK/nuYh8DYS+n7uaSuSIdw4HJemyRkXsWjAEPtEgD7taGMafZGbP5pl+XE38SE59jTBxmKnkUEZOFMgZGA==}
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
'@sentry/types': 7.86.0
|
||||
'@sentry/utils': 7.86.0
|
||||
'@sentry/types': 7.87.0
|
||||
'@sentry/utils': 7.87.0
|
||||
|
||||
/@sentry/integrations@7.86.0:
|
||||
resolution: {integrity: sha512-BStRH1yBhhUsvmCXWx88/1+cY93l4B+3RW60RPeYcupvUQ1DJ8qxfN918+nA9XoZt9XELXvs8USCqqynG/aEkg==}
|
||||
/@sentry/integrations@7.87.0:
|
||||
resolution: {integrity: sha512-xbyOQeyfG1sF2PBMIOz3c3i0Y3+8q4UlxoeOhpFe6Vpjek+I/g7onZT6YevT6cWG083cg+rS0VCgPQSUV2lxIw==}
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
'@sentry/core': 7.86.0
|
||||
'@sentry/types': 7.86.0
|
||||
'@sentry/utils': 7.86.0
|
||||
'@sentry/core': 7.87.0
|
||||
'@sentry/types': 7.87.0
|
||||
'@sentry/utils': 7.87.0
|
||||
localforage: 1.10.0
|
||||
dev: false
|
||||
|
||||
/@sentry/node@7.86.0:
|
||||
resolution: {integrity: sha512-cB1bn/LMn2Km97Y3hv63xwWxT50/G5ixGuSxTZ3dCQM6VDhmZoCuC5NGT3itVvaRd6upQXRZa5W0Zgyh0HXKig==}
|
||||
/@sentry/node@7.87.0:
|
||||
resolution: {integrity: sha512-mGcZMCL3/IMTLIRcWLF+H9z2Bb2d34gKmg2rhXqI8BqhhUA551jMRlZv/y4za2Osjy550KwVoNsA1qtEe5mYyQ==}
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
'@sentry-internal/tracing': 7.86.0
|
||||
'@sentry/core': 7.86.0
|
||||
'@sentry/types': 7.86.0
|
||||
'@sentry/utils': 7.86.0
|
||||
'@sentry-internal/tracing': 7.87.0
|
||||
'@sentry/core': 7.87.0
|
||||
'@sentry/types': 7.87.0
|
||||
'@sentry/utils': 7.87.0
|
||||
https-proxy-agent: 5.0.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -6903,8 +6903,8 @@ packages:
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/@sentry/types@7.86.0:
|
||||
resolution: {integrity: sha512-pGAt0+bMfWgo0KG2epthfNV4Wae03tURpoxNjGo5Fr4cXxvLTSijSAQ6rmmO4bXBJ7+rErEjX30g30o/eEdP9g==}
|
||||
/@sentry/types@7.87.0:
|
||||
resolution: {integrity: sha512-w8jKFHq/Llupmr2FezmFgQsnm3y/CnqLjb7s6PstI78E409wrhH7p7oqX/OEuzccH1qNCNwes/3QKvPTRQDB4Q==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
/@sentry/utils@7.60.1:
|
||||
@@ -6915,11 +6915,11 @@ packages:
|
||||
tslib: 2.6.1
|
||||
dev: true
|
||||
|
||||
/@sentry/utils@7.86.0:
|
||||
resolution: {integrity: sha512-6PejFtw9VTFFy5vu0ks+U7Ozkqz+eMt+HN8AZKBKErYzX5/xs0kpkOcSRpu3ETdTYcZf8VAmLVgFgE2BE+3WuQ==}
|
||||
/@sentry/utils@7.87.0:
|
||||
resolution: {integrity: sha512-7xgtPTnTNP/4IznFMFXxltuaXfLvzznrYCDMv9ny8EeUjJqlLX3CVA8Qq3YALsLCQCKcrGRARbAcd/EGG//w2w==}
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
'@sentry/types': 7.86.0
|
||||
'@sentry/types': 7.87.0
|
||||
|
||||
/@sentry/vite-plugin@2.5.0:
|
||||
resolution: {integrity: sha512-u5lfIysy6UVzUGn/adyDcRXfzFyip4mLGThTnKeOeA9rCgmJUVnErH8TD8xhTKdpq/MBiQ+KqrC6xG9pKCa96g==}
|
||||
|
||||
Reference in New Issue
Block a user