目前,状态为5xx的服务器错误已登录到哨兵中。
如何将4xx状态作为警告记录错误?
哨兵:
Sentry.init({
dsn: 'https://server.com/8',
integrations: [
new Sentry.Integrations.Http({ tracing: true }),
new Tracing.Integrations.Express({ app: server }),
new Tracing.Integrations.Postgres(),
new ExtraErrorDataIntegration(),
],
environment: 'ENV',
release: 'n/a',
tracesSampleRate: 1.0,
enabled: true,
});发布于 2021-06-29 18:54:17
shouldHandleError截取数据。
在此处理程序中,可以更改级别。
server.use(Sentry.Handlers.errorHandler({
shouldHandleError(error) {
if (/^[4]/.test(error.statusCode)) {
Sentry.configureScope((scope) => {
scope.setLevel(Sentry.Severity.Warning);
});
}
return true;
},
}));https://stackoverflow.com/questions/68149840
复制相似问题