const { NodeSDK } = require('@opentelemetry/sdk-node'); const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-proto'); const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http'); const { ExpressInstrumentation } = require('@opentelemetry/instrumentation-express'); const sdk = new NodeSDK({ traceExporter: new OTLPTraceExporter(), instrumentations: [ new HttpInstrumentation(), new ExpressInstrumentation(), ], }); sdk.start(); process.on('SIGTERM', () => { sdk.shutdown() .then(() => console.log('tracing terminated')) .finally(() => process.exit(0)); });