|
| 1 | +// Import with `const Sentry = require("@sentry/nestjs");` if you are using CJS |
| 2 | +import * as Sentry from '@sentry/nestjs'; |
| 3 | + |
| 4 | +Sentry.init({ |
| 5 | + dsn: 'https://ddb767c749d4c40c6a83bd1ec1750ded@o1347126.ingest.us.sentry.io/4510154827366400', |
| 6 | + // Setting this option to true will send default PII data to Sentry. |
| 7 | + // For example, automatic IP address collection on events |
| 8 | + sendDefaultPii: true, |
| 9 | +}); |
| 10 | + |
| 11 | +// |
| 12 | +// =================================== |
| 13 | +// OpenTelemetry Initialization |
| 14 | +// =================================== |
| 15 | +// |
| 16 | +// The OpenTelemetry SDK must be initialized BEFORE any other modules are imported. |
| 17 | +// This ensures that instrumentation can correctly patch the necessary libraries |
| 18 | +// and capture telemetry from the very beginning of the application's lifecycle. |
| 19 | +// |
| 20 | +//import { NodeSDK } from '@opentelemetry/sdk-node'; |
| 21 | +//import openTelemetryConfig from './open-telemetry.config.json'; // Assuming this config file exists in your new project |
| 22 | + |
| 23 | +// const openTelemetry = new NodeSDK(openTelemetryConfig); |
| 24 | + |
| 25 | +// try { |
| 26 | +// openTelemetry.start(); |
| 27 | +// console.log('✅ OpenTelemetry SDK started successfully.'); |
| 28 | +// } catch (error) { |
| 29 | +// console.error('❌ Could not start OpenTelemetry SDK:', error); |
| 30 | +// process.exit(1); |
| 31 | +// } |
| 32 | + |
| 33 | +// // Gracefully shut down the OpenTelemetry SDK on process exit. |
| 34 | +// process.on('SIGTERM', () => { |
| 35 | +// openTelemetry |
| 36 | +// .shutdown() |
| 37 | +// .then(() => console.log('➡️ OpenTelemetry tracing terminated.')) |
| 38 | +// .catch((error) => console.error('Error terminating OpenTelemetry tracing:', error)) |
| 39 | +// .finally(() => process.exit(0)); |
| 40 | +// }); |
0 commit comments