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