/
githubmirror
/
novu
Обзор
Документация
Войти
/
githubmirror
/
novu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
apps/api/src/instrument.ts
37 строк
2 KB
cursor[bot]
fix(api-service): ignore client abort noise in Sentry config fixes NV-8271 (#12105)
27 июл 2026, 10:44
Не верифицирован
27 июл 2026, 10:44
487df10
Код
Авторство
О чём код?
import './config/env.config'; // Import from the tracing subpath, NOT the main barrel. The barrel loads // @novu/application-generic which transitively pulls in pino/mongoose/ioredis. // TypeScript hoists all imports — if pino loads before startOtel() registers // instrumentations, PinoInstrumentation cannot patch the already-bound references. // Importing only otel-init keeps those modules out of require.cache until after // the SDK's require()-hooks are in place. import { startOtel } from '@novu/application-generic/build/main/tracing/otel-init'; import { name, version } from '../package.json'; startOtel(name, version); // biome-ignore lint: must execute after startOtel() so New Relic layers on top require('newrelic'); // biome-ignore lint: lazy require so @sentry/nestjs loads after OTEL instrumentations are installed const { init } = require('@sentry/nestjs'); if (process.env.SENTRY_DSN) { init({ dsn: process.env.SENTRY_DSN, environment: process.env.NODE_ENV, release: `v${version}`, ignoreErrors: [ 'Non-Error exception captured', // Clients disconnect before the request body is fully read (e.g. inbox session). 'request aborted', ], // When startOtel() already registered the OTEL SDK (ENABLE_OTEL=true), // Sentry must not register its own providers — doing so triggers // "Attempted duplicate registration of API: trace/context/propagation" // errors that corrupt the shared OTEL state and break New Relic's // data pipeline. With this flag Sentry reuses the existing SDK. skipOpenTelemetrySetup: process.env.ENABLE_OTEL === 'true', }); }