chore: Add server_type tag to Sentry errors (no-changelog) (#11277)

This commit is contained in:
Iván Ovejero 2024-10-16 11:47:05 +02:00 committed by GitHub
parent 785b47feb3
commit e7a4b0da01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,6 +3,7 @@ import { GlobalConfig } from '@n8n/config';
import { QueryFailedError } from '@n8n/typeorm';
import { AxiosError } from 'axios';
import { createHash } from 'crypto';
import { InstanceSettings } from 'n8n-core';
import { ErrorReporterProxy, ApplicationError } from 'n8n-workflow';
import Container from 'typedi';
@ -30,7 +31,7 @@ export const initErrorHandling = async () => {
DEPLOYMENT_NAME: serverName,
} = process.env;
const { init, captureException } = await import('@sentry/node');
const { init, captureException, setTag } = await import('@sentry/node');
const { RewriteFrames } = await import('@sentry/integrations');
const { Integrations } = await import('@sentry/node');
@ -95,6 +96,8 @@ export const initErrorHandling = async () => {
},
});
setTag('server_type', Container.get(InstanceSettings).instanceType);
ErrorReporterProxy.init({
report: (error, options) => captureException(error, options),
});