/
githubmirror
/
novu
Обзор
Документация
Войти
/
githubmirror
/
novu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
apps/worker/src/instrument.ts
33 строки
1 KB
Himanshu Garg
chore(root): bump new relic version to fix mongo instrumentation and prevent clash with sentry otel (#10986)
06 май 2026, 09:52
Не верифицирован
06 май 2026, 09:52
ee499ea
Код
Авторство
О чём код?
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'], // 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', }); }